A DevOps team is setting up an automated Infrastructure as Code (IaC) pipeline using Terraform to provision Compute Engine resources and service accounts for a new analytics platform. The team must ensure secure state management and adhere to the principle of least privilege for the deployment pipeline's service account. Which two actions should the team take to meet these security and operational requirements?
- Configure a Cloud Storage backend with object versioning enabled to store the Terraform state file securely.Cevap
- Grant the deployment pipeline service account the Service Account User role (roles/iam.serviceAccountUser) on the target workload service account.Cevap
- CStore the Terraform state file in unversioned local storage on the ephemeral CI/CD runner host.
- DAssign the primitive Editor role (roles/editor) to the deployment pipeline service account at the project level.
- EGrant the Service Account Admin role (roles/iam.serviceAccountAdmin) to the deployment pipeline service account so it can bind to instances.
Cevap
The correct architectural decisions are configuring a Cloud Storage backend with object versioning for storing the Terraform state file, and granting the deployment pipeline service account the Service Account User role (roles/iam.serviceAccountUser) on the target workload service account.
To safely provision compute resources in an automated pipeline, remote state management using Cloud Storage with versioning prevents state loss and race conditions. Furthermore, following least privilege requires assigning `roles/iam.serviceAccountUser` to the deployment service account so it can attach the target identity to virtual machines without granting administrative power over the service account lifecycle or broad project resources.
Adım Adım Çözüm
Anahtar Kavram
Provisioning Compute Infrastructure using IaC Best Practices and IAM Least Privilege