A financial services organization is implementing a CI/CD pipeline using Cloud Build to automate the deployment of multi-tier cloud infrastructure defined in Terraform. The security team requires that the pipeline strictly enforce least-privilege security controls and prevent credentials exposure when creating resources and deploying applications under specific workload service accounts. Which architectural approach should the cloud architect choose for the Cloud Build pipeline configuration?
- Configure Cloud Build to execute using a dedicated custom pipeline service account with specific resource permissions, and grant this pipeline service account the Service Account User role on the target runtime service accounts.Cevap
- BAssign the primitive Editor role to the default Cloud Build service account at the organization level to ensure all Terraform resource creation commands complete without permission errors.
- CGrant the pipeline service account the Service Account Admin role on the target workload service accounts so that Cloud Build can generate and manage temporary JSON service account keys during execution.
- DConfigure Cloud Build steps to store Terraform state files locally in the build container's ephemeral workspace directory to optimize build speed and prevent remote backend unauthorized access.
Cevap
The optimal strategy is to run Cloud Build using a dedicated custom service account assigned minimal specific permissions, and grant that custom service account the Service Account User role (`roles/iam.serviceAccountUser`) on the target workload service accounts.
Running Cloud Build with a dedicated custom service account configured with granular, minimal permissions meets enterprise security compliance. Granting `roles/iam.serviceAccountUser` on specific target workload identities allows the pipeline service account to attach those identities to newly deployed resources (such as GKE nodes or Cloud Run services) without requiring administrative rights over service accounts or excessive primitive roles.
Adım Adım Çözüm
Anahtar Kavram
CI/CD Pipeline Security and Least-Privilege IAM Design with Cloud Build