Question

Difficulty: EasyAutomating Continuous Deployment Pipelines and Release Strategies

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?

  1. Store the Terraform state file in a Cloud Storage bucket with object versioning and state locking configured as a remote backend.Answer
  2. B
    Keep the Terraform state file in unversioned local directory storage and commit it to source control prior to running pipelines.
  3. C
    Assign the primitive Owner role to the deployment pipeline service account to bypass Cloud Storage bucket permissions.
  4. D
    Grant 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

1
Identify the risk associated with local state files in automated pipelines.
Local state files cause concurrency conflicts and risk corruption when multiple pipelines run simultaneously.
Automated deployments require a shared, reliable single source of truth for infrastructure state.
2
Select the GCP remote backend solution designed for Terraform state.
Cloud Storage bucket with versioning enabled and native object locking.
Cloud Storage supports Terraform remote backends, maintaining version history and preventing simultaneous modification conflicts.

Key Concept

Automating Continuous Deployment Pipelines and Release Strategies - IaC State Management
Rate this question