An enterprise architecture team is configuring an automated CI/CD pipeline using Cloud Build and Terraform to provision resources across target Google Cloud projects. The team must adhere to Google Cloud security best practices by applying the principle of least privilege to the pipeline service account while ensuring concurrency safety and state integrity during automated deployments. Which provisioning strategy should the team implement?
- Assign fine-grained predefined IAM roles for target services and the Service Account User role to the Cloud Build service account, while configuring a remote Cloud Storage backend with object versioning and state locking enabled.Answer
- BAssign the primitive Owner role at the organization level to the Cloud Build service account to prevent permission failures during provisioning, while storing state locally within the ephemeral build execution environment.
- CAssign the Service Account Admin role to the Cloud Build service account to allow attached compute resources to execute tasks, while configuring a remote Cloud Storage backend without object versioning.
- DGenerate static service account JSON keys and embed them within the Terraform provider configuration, while disabling state locking to increase parallel execution speed.
Answer
Assign fine-grained predefined IAM roles for target services and the Service Account User role to the Cloud Build service account, while configuring a remote Cloud Storage backend with object versioning and state locking enabled.
The correct strategy enforces the principle of least privilege by combining fine-grained predefined target roles with the Service Account User role for service account impersonation. Additionally, configuring a Google Cloud Storage remote backend with versioning and object locking guarantees state file resilience and prevents concurrent pipelines from corrupting infrastructure state.
Step-by-Step Solution
Key Concept
Secure IaC automation using least-privilege service accounts and centralized Cloud Storage backend with state locking.
Estimated Time:1m 30s