A cloud administrator is setting up a shared Google Cloud Storage (GCS) backend for a team using Terraform to provision Google Cloud infrastructure. The administrator must ensure that simultaneous deployments by different engineers do not cause race conditions or state file corruption. Which GCS backend capability does Terraform automatically utilize to prevent concurrent state updates?
- Native object locking built into the Google Cloud Storage backend pluginAnswer
- BAssigning primitive Owner roles on the storage bucket to all deployment service accounts to override write locks
- CMaintaining state files in unversioned local directory storage and merging changes manually through Git repositories
- DGranting the Service Account Admin role to engineers so they can manually unlock lock files using administrative credentials
Answer
Terraform natively uses built-in Google Cloud Storage object locking within the GCS backend to handle state locking automatically during operations.
The correct choice highlights the built-in capability of Terraform's GCS backend plugin, which utilizes native Google Cloud Storage locking mechanisms to lock the state file during execution automatically. This prevents concurrent operations from corrupting the state file without needing extra IAM overrides or external databases.
Step-by-Step Solution
Key Concept
Terraform Remote State Management and Locking using Google Cloud Storage Backend