An enterprise logistics company is designing an automated Continuous Integration and Continuous Delivery (CI/CD) pipeline using Cloud Build and Terraform to provision infrastructure across separate Google Cloud projects for staging and production. The security architecture mandates strict least-privilege enforcement, zero static service account keys in the pipeline, and protection against Terraform state corruption or concurrent execution conflicts across environments. Which CI/CD architecture design meets all technical and security requirements?
- Configure Cloud Build triggers to impersonate dedicated environment-specific service accounts using short-lived credentials via IAM role impersonation, store Terraform state remotely in Cloud Storage buckets with Object Versioning enabled, and grant Cloud Build permissions to generate short-lived tokens.Answer
- BGrant the default Cloud Build service account the Editor primitive role across all target projects to streamline resource deployment, and store Terraform state files in local build worker storage during pipeline execution.
- CGrant developers the Service Account Admin role to allow pipeline customization, execute Cloud Build steps using local state files inside the build container filesystem, and commit state updates back to Git source control repositories.
- DExport JSON service account keys with Owner permissions, store them as encrypted Cloud Storage objects for Cloud Build steps to download during runtime, and persist state in unversioned Cloud Storage buckets.
Answer
Configure Cloud Build triggers to impersonate dedicated environment-specific service accounts using short-lived credentials via IAM role impersonation, store Terraform state remotely in Cloud Storage buckets with Object Versioning enabled, and grant Cloud Build permissions to generate short-lived tokens.
The optimal design pattern for Google Cloud CI/CD infrastructure pipelines uses short-lived credentials via IAM service account impersonation combined with remote state storage in Cloud Storage. Object Versioning and native GCS state locking prevent state file corruption during concurrent builds while upholding least-privilege security standards.
Step-by-Step Solution
Key Concept
Secure CI/CD IaC Pipeline Architecture with Service Account Impersonation and Remote State Backend Locking