An enterprise organization is automating its continuous deployment pipeline using Google Cloud Deploy to roll out application releases across multiple GKE environments. The architecture team needs to ensure that the infrastructure state files managed by Terraform during pipeline execution are safe from concurrent modification and state corruption, while ensuring the execution service account adheres to the principle of least privilege. Which deployment pipeline configuration should the team implement?
- Configure the Terraform pipeline to use a Cloud Storage backend with object versioning and state locking enabled, and assign fine-grained predefined roles to the Cloud Deploy execution service account.Answer
- BAssign the primitive Owner role to the Cloud Deploy execution service account, and store the Terraform state file in a local directory within the build runner workspace.
- CStore the Terraform state file in an unversioned local directory within the Cloud Build runner, and grant the execution service account the Service Account Admin role.
- DGrant the Service Account Admin role to the Cloud Deploy execution service account so it can manage identity bindings during deployment, while keeping state files in local storage.
Answer
Configure the Terraform pipeline to use a Cloud Storage backend with object versioning and state locking enabled, and assign fine-grained predefined roles to the Cloud Deploy execution service account.
Configuring a Cloud Storage backend for Terraform ensures state files are persisted remotely with automatic object locking to prevent concurrent apply conflicts. Combining this with fine-grained predefined IAM roles for the Cloud Deploy execution service account adheres strictly to least-privilege access security controls.
Step-by-Step Solution
Key Concept
Continuous Deployment Pipeline Security and IaC State Management