Question

Difficulty: Very hardBuilding and Managing Infrastructure as Code (IaC)

An enterprise financial organization manages its Google Cloud infrastructure using Terraform within an automated CI/CD pipeline. Multiple autonomous feature teams frequently provision and update resources across shared VPC networks. Recently, a CI/CD deployment failed during a Terraform apply phase because an operational team manually modified firewall rules and updated subnets directly via the Cloud Console to mitigate an active security incident. Furthermore, state locks were intermittently failing during concurrent CI/CD pipeline executions due to misconfigured remote state storage. What architecture and operational strategy should the Lead Cloud Architect implement to secure state management and prevent uncoordinated configuration drift in accordance with Google Cloud best practices?

  1. Configure a central Cloud Storage backend with object versioning and state locking enabled, enforce IaC updates exclusively through a CI/CD pipeline executing with a dedicated service account assigned fine-grained predefined roles, and run scheduled automated plan workflows to detect configuration drift.Answer
  2. B
    Assign the IAM Owner role to the CI/CD pipeline service account across all target projects to prevent permission failures during provisioning, and instruct team members to run local terraform refresh commands prior to executing console modifications.
  3. C
    Maintain state files in local git repositories alongside application source code to allow concurrent branch tracking, and run manual gcloud commands to sync infrastructure state whenever console edits occur during incidents.
  4. D
    Implement manual console deployment procedures for urgent infrastructure changes, followed by manual updates to Terraform resource blocks after the incident resolves, relying on pipeline quota increases to handle concurrent state operations.

Answer

Configure a central Cloud Storage backend with object versioning and state locking enabled, enforce IaC updates exclusively through a CI/CD pipeline executing with a dedicated service account assigned fine-grained predefined roles, and run scheduled automated plan workflows to detect configuration drift.
The correct strategy establishes a central Cloud Storage backend with object versioning and state locking to ensure concurrency control and recoverability, restricts infrastructure modifications to an automated CI/CD pipeline using least-privilege service accounts, and routinely executes scheduled plan operations to identify drift.

Step-by-Step Solution

1
Establish secure remote state management
Configured a Google Cloud Storage (GCS) backend with object versioning and state locking enabled to guarantee state persistence, concurrency control, and disaster recovery.
Prevents state corruption and race conditions during simultaneous pipeline triggers across feature teams.
2
Restrict deployment permissions to CI/CD automation
Configured the CI/CD deployment pipeline using a dedicated service account with granular predefined IAM roles rather than broad primitive roles.
Enforces least-privilege security and eliminates uncoordinated, manual out-of-band edits from human operators.
3
Implement automated drift detection workflows
Scheduled recurring terraform plan execution runs within the automated pipeline.
Identifies discrepancies between actual infrastructure states and declared IaC configuration early, mitigating configuration drift.

Key Concept

Centralized Remote State Management, Drift Detection, and Least Privilege CI/CD Pipeline Scoping in Infrastructure as Code
Estimated Time:3m 0s
Rate this question