A DevOps team uses Terraform to provision and maintain their Google Cloud environments. To ensure operational reliability and prevent state corruption caused by concurrent deployments, the team needs to configure a central backend for storing Terraform state files. Which configuration approach aligns with Google Cloud best practices for managing Infrastructure as Code state?
- Store the Terraform state file in a Google Cloud Storage bucket configured as a remote backend with object versioning enabled.Cevap
- BStore the Terraform state file locally on the CI/CD runner's disk and commit the file to version control after each deployment execution.
- CStore the Terraform state file in a Google Cloud Storage bucket and assign the CI/CD deployment service account the Owner primitive role to ensure access.
- DStore the Terraform state file in a Google Cloud Storage bucket and grant the CI/CD pipeline service account the Service Account Admin role to run provisioning tasks.
Cevap
Store the Terraform state file in a Google Cloud Storage bucket configured as a remote backend with object versioning enabled.
Using a Google Cloud Storage bucket as a remote backend for Terraform is the Google Cloud standard for managing Infrastructure as Code state. GCS remote backends natively support automatic state locking during execution and allow enabling object versioning to recover state in case of accidental corruption or invalid changes.
Adım Adım Çözüm
Anahtar Kavram
Terraform Remote State Backend Management in Google Cloud Storage