A Cloud Architecture team is setting up Terraform for multi-developer infrastructure provisioning on Google Cloud. They need to ensure safe state collaboration, avoid state corruption during concurrent updates, and preserve historical state versions. Which backend architecture should the team implement to adhere to Google Cloud best practices?
- Configure the Terraform backend to use a Google Cloud Storage bucket with object versioning enabled to support remote state locking and recovery.Answer
- BStore the Terraform state files on an unversioned shared local disk attached to a Compute Engine virtual machine.
- CAssign the primitive Owner role to the deployment service account to ensure unblocked state updates across all resources.
- DGrant developers the Service Account Admin role to allow service account key management during Terraform execution.
Answer
Configure the Terraform backend to use a Google Cloud Storage bucket with object versioning enabled.
Using a Google Cloud Storage bucket with object versioning enabled as the Terraform remote backend is the recommended standard. It provides state locking natively to prevent concurrent executions from corrupting state, while object versioning enables easy recovery if a state file becomes corrupted or accidentally overwritten.
Step-by-Step Solution
Key Concept
Terraform Remote State Management with Cloud Storage