A cloud engineering team is adopting Terraform to manage infrastructure deployments on Google Cloud. Multiple team members will be executing Terraform configurations simultaneously. Which deployment pattern is the Google Cloud recommended best practice for storing and managing the Terraform state file safely?
- Store the state file in a Google Cloud Storage (GCS) bucket configured as a remote backend with Object Versioning enabled.Cevap
- BKeep state files on local developer workstations and commit updated state files to a central Git version control repository after each apply.
- CApply modifications manually using the Google Cloud Console first, then rely on terraform refresh to update the local state file.
- DGrant the primitive Owner role to all deployment service accounts to bypass bucket-level IAM permission checks when reading state files.
Cevap
Store the state file in a Google Cloud Storage (GCS) bucket configured as a remote backend with Object Versioning enabled.
Configuring a Google Cloud Storage (GCS) bucket as the remote backend is the standard best practice for Terraform on GCP. GCS supports native state locking using Cloud Storage lock objects, ensuring that simultaneous executions do not corrupt the state. Enabling Object Versioning allows teams to rollback to previous state versions if needed.
Adım Adım Çözüm
Anahtar Kavram
Building and Managing Infrastructure as Code (IaC) Remote State Management