An online interactive media enterprise is analyzing its continuous integration and continuous delivery (CI/CD) software development lifecycle (SDLC) pipeline. The pipeline uses Cloud Build to execute Terraform configurations that provision application infrastructure across Google Cloud projects. A technical audit reveals security and operational vulnerabilities in how the pipeline executes build steps and manages deployment state. Which architectural recommendation should the Cloud Architect make to align the CI/CD pipeline with Google Cloud security and reliability best practices?
- Attach a dedicated custom service account with minimal required predefined roles to the Cloud Build trigger, and store the Terraform state in a Cloud Storage bucket with object versioning and state locking enabled.Answer
- BGrant the primitive Owner role to the default Cloud Build service account to prevent permission errors during deployment, and store the Terraform state in a standard Cloud Storage bucket without versioning.
- CGrant the Service Account Admin role to the pipeline service account so it can manage compute instances and service account keys, while storing state files in local workspace storage.
- DMaintain the Terraform state file on the ephemeral local disk of the Cloud Build worker instance to minimize build latency and rely solely on standard IAM to prevent exfiltration.
Answer
Attach a dedicated custom service account with minimal required predefined roles to the Cloud Build trigger, and store the Terraform state in a Cloud Storage bucket with object versioning and state locking enabled.
Configuring Cloud Build to execute using a dedicated custom service account with granular, least-privilege predefined roles reduces the blast radius of build execution. Pairing this with a remote Cloud Storage backend configured with object versioning and state locking guarantees concurrent execution protection, state persistence, and disaster recovery for Infrastructure as Code.
Step-by-Step Solution
Key Concept
CI/CD Pipeline Security and Infrastructure as Code State Management
Estimated Time:1m 30s