A multinational e-commerce company manages its core infrastructure across multiple Google Cloud projects using Terraform executed through an automated CI/CD pipeline. Following a recent operational incident, an engineer manually updated Cloud Storage bucket IAM policies and Compute Engine instance metadata via the Google Cloud Console to restore connectivity. This manual intervention created configuration drift between the actual running resources and the version-controlled Terraform state. To enforce strict IaC governance, the lead cloud architect needs an automated strategy to continuously detect configuration drift, restrict manual resource modifications going forward, and safely re-align the environment with the canonical Terraform definitions. Which operational design best achieves this objective while adhering to Google Cloud recommended best practices?
- Schedule recurring non-destructive pipeline jobs running `terraform plan -detailed-exitcode` to detect drift, enforce Organization Policies and IAM fine-grained role boundaries to block direct Console modifications, and reconcile verified drift by updating Terraform code or executing automated `terraform apply` pipelines.Answer
- BInstruct emergency operators to run `terraform refresh` locally to overwrite the existing Cloud Storage remote state file with current live resource configurations, then upload the updated state without modifying the core Terraform codebase.
- CDownload the Cloud Storage state file to local runner storage during pipeline execution, perform raw JSON edits to account for manual changes, and disable backend state locking during deployment to accelerate reconciliation.
- DAssign the primitive Owner role (`roles/owner`) to the CI/CD pipeline service account across all projects to ensure `terraform apply` automatically overrides any console changes without requiring pre-execution validation plans.