A pharmaceutical distribution company manages its Google Cloud infrastructure using Terraform within a centralized Cloud Build CI/CD pipeline. During an emergency operational incident, an engineer manually updated the machine type and auto-scaling limits of an unmanaged instance group directly in the Google Cloud Console. The infrastructure team now needs to resolve this configuration drift and bring the state back into alignment with IaC governance standards without tearing down existing production workloads. Which approach should the cloud architect recommend?
- Update the local Terraform HCL codebase to reflect the upgraded instance group specifications, execute a terraform plan to confirm zero resource destruction, and commit the changes to trigger the pipeline.Cevap
- BContinue allowing manual updates via the Cloud Console during operational incidents, and execute a scheduled terraform apply step with a force flag to overwrite drift automatically.
- CDelete the existing remote Terraform state object in the Cloud Storage bucket and re-run terraform init to rebuild the state file from scratch.
- DGrant the Cloud Build service account the Project Owner primitive role across all environments so the pipeline can forcefully reconcile unmanaged resources.
Cevap
Update the local Terraform HCL codebase to reflect the upgraded instance group specifications, execute a terraform plan to confirm zero resource destruction, and commit the changes to trigger the pipeline.
The correct approach is to update the Terraform HCL code to match the manual configuration changes, perform a plan check to ensure no destructive updates are scheduled, and commit the code to version control. This restores parity between code, state, and live GCP resources while maintaining IaC governance.
Adım Adım Çözüm
Anahtar Kavram
Remediating Infrastructure Configuration Drift in Terraform
Tahmini Süre:1m 30s