A cloud administrator at a media streaming enterprise discovers that a security analyst manually modified a Compute Engine firewall rule using the Google Cloud Console during an emergency incident response. The environment's infrastructure is managed using Terraform. Which action should the administrator take to align the actual infrastructure state with the source-controlled configuration code?
- Run terraform plan to identify the configuration drift, and then execute terraform apply to revert the manual changes back to the defined code state.Cevap
- BManually edit the firewall rule via the Cloud Console again to match the settings written in the Terraform code.
- CDelete the remote Terraform state file stored in Google Cloud Storage so Terraform can rediscover and recreate all resources.
- DAssign the primitive Owner role to the deployment pipeline service account to bypass firewall validation checks.
Cevap
Run terraform plan to identify the configuration drift, and then execute terraform apply to revert the manual changes back to the defined code state.
Terraform maintains resource states declaratively. When manual modifications occur in Google Cloud outside of the IaC workflow, running `terraform plan` compares the real-world infrastructure against the configuration code to highlight the drift. Running `terraform apply` overwrites the out-of-band console changes and restores the firewall rule to match the declared source code.
Adım Adım Çözüm
Anahtar Kavram
Infrastructure as Code Drift Remediation