An infrastructure team is automating continuous deployment pipelines for Google Kubernetes Engine (GKE) targets using Terraform and Cloud Deploy. During pipeline executions, team members express concern that local state storage could lead to state corruption and concurrency issues across pipeline runs. Which configuration should the team implement to secure and maintain their Terraform state file?
- Store the Terraform state file in a Cloud Storage bucket with object versioning and state locking configured as a remote backend.Answer
- BKeep the Terraform state file in unversioned local directory storage and commit it to source control prior to running pipelines.
- CAssign the primitive Owner role to the deployment pipeline service account to bypass Cloud Storage bucket permissions.
- DGrant the Service Account Admin role to the pipeline service account so it can impersonate deployment targets.
Answer
Store the Terraform state file in a Cloud Storage bucket with object versioning and state locking configured as a remote backend.
Configuring a Google Cloud Storage bucket with object versioning and state locking as a remote backend ensures a centralized, durable, and concurrency-safe repository for Terraform state files across automated release pipelines.
Step-by-Step Solution
Key Concept
Automating Continuous Deployment Pipelines and Release Strategies - IaC State Management