An enterprise organization is deploying core cloud infrastructure to Google Cloud using Terraform. Multiple cloud engineers perform concurrent deployments across automated CI/CD pipelines and local workstations. The lead architect must ensure that Terraform state files are securely protected against corruption, support state locking during concurrent execution, retain historical state versions for disaster recovery, and follow GCP least-privilege security principles. Which architecture configuration should the team implement?
- Configure a Cloud Storage (GCS) backend in Terraform with object versioning enabled, using Cloud IAM fine-grained roles for service account access control.Cevap
- BStore the Terraform state files in a local directory synchronized to a shared Git repository, ensuring engineers commit state changes after each deployment.
- CStore Terraform state in a GCS bucket and assign the primitive Owner role (roles/owner) to the deployment service account to guarantee complete execution access across state locks.
- DMaintain state files on compute instances and manually resolve resource conflict states by modifying resource configurations directly within the GCP Console prior to running Terraform apply.
Cevap
Configure a Cloud Storage (GCS) backend in Terraform with object versioning enabled, using Cloud IAM fine-grained roles for service account access control.
Configuring a Cloud Storage (GCS) bucket as the remote backend for Terraform inherently provides atomic state locking and consistency. Enabling object versioning ensures state history retention for rollback or recovery, while applying granular IAM roles enforces security best practices.
Adım Adım Çözüm
Anahtar Kavram
Terraform Remote Backend and State Management Best Practices on GCP
Tahmini Süre:1m 30s