A financial enterprise is designing a Continuous Integration and Continuous Delivery (CI/CD) pipeline on Google Cloud using Cloud Build and Terraform to manage infrastructure deployments inside a restricted security environment governed by VPC Service Controls. The architecture team requires that the pipeline prevents configuration drift, protects state files against concurrency corruption and exfiltration, and strictly enforces the principle of least privilege. Which TWO architectural controls should be implemented in this CI/CD pipeline design? (Select TWO.)
- Store the Terraform state file in a Cloud Storage bucket configured with object versioning and state locking, executing builds via Cloud Build private worker pools inside the network perimeter.Answer
- Grant the Cloud Build trigger service account the Service Account User role (roles/iam.serviceAccountUser) on a dedicated custom deployment service account to perform resource provisioning through short-lived impersonation.Answer
- CAssign the primitive Owner role (roles/owner) directly to the Cloud Build default service account to prevent permission errors when provisioning complex multi-resource topologies.
- DMaintain the Terraform state file within the ephemeral container storage of the Cloud Build runner workspace to avoid external network calls and prevent state data exfiltration.
Answer
The optimal design requires storing Terraform state in a versioned Cloud Storage bucket with state locking while running builds on Cloud Build private worker pools inside the VPC Service Controls perimeter, and granting the build service account the Service Account User role to impersonate a dedicated deployment service account.
The correct approach combines secure remote state management with private network execution and fine-grained identity impersonation. Storing Terraform state in a Cloud Storage bucket with object versioning and state locking prevents state file corruption and concurrency conflicts during concurrent deployments. Executing Cloud Build builds on private worker pools allows secure deployment within a VPC Service Controls perimeter. Additionally, granting the Cloud Build build trigger service account the `roles/iam.serviceAccountUser` role on a dedicated deployment service account enables minimal, audited permission delegation through service account impersonation.
Step-by-Step Solution
Key Concept
Secure CI/CD Pipeline Design with Cloud Build, IaC State Locking, and IAM Service Account Impersonation