An enterprise organization is designing an automated IaC pipeline to manage multi-tenant infrastructure across hundreds of Google Cloud projects. The architecture team wants to allow feature teams to validate resource changes during continuous integration without permitting them to apply modifications directly or expose infrastructure state sensitive data. Additionally, deployment pipeline execution must strictly follow least-privilege access when creating and updating Google Cloud resources across target projects. Which IaC architecture and IAM configuration should you implement?
- Configure Cloud Storage remote backends with object versioning and state locking in a central management project. Grant feature team CI roles read-only access to plan outputs while executing Terraform runs using short-lived credentials via service account impersonation (`roles/iam.serviceAccountTokenCreator`) mapped to targeted predefined roles in workload projects.Answer
- BStore Terraform state files in local git repositories for local pipeline validation, and grant the CI pipeline service account the primitive Owner role (`roles/owner`) on all target GCP projects to eliminate permission errors during resource provisioning.
- CGrant feature team members the Service Account Admin role (`roles/iam.serviceAccountAdmin`) across target projects so the CI pipeline can create dedicated keys on demand for plan and apply stages.
- DUse unversioned Cloud Storage buckets for state files without object locking to maximize pipeline throughput, and submit regional quota increase requests only after plan validation failures occur.
Answer
The optimal architecture uses centralized Google Cloud Storage remote backends with versioning and object locking, combined with short-lived service account impersonation (`roles/iam.serviceAccountTokenCreator`) and least-privilege predefined roles in target projects.
Centralizing Terraform remote state in Google Cloud Storage with object versioning and state locking protects infrastructure state integrity. Implementing short-lived service account token creation allows automated pipelines to provision resources across target projects with least-privilege fine-grained roles without storing persistent service account keys.
Step-by-Step Solution
Key Concept
Infrastructure as Code Multi-Project Governance and Least-Privilege IAM Provisioning