A central platform engineering team is establishing automated infrastructure management and software deployment patterns across multiple Google Cloud projects. The team currently relies on long-lived service account JSON keys exported to external CI/CD pipelines, stores Terraform state files locally on runner build agents, and grants broad administrative permissions to prevent pipeline failures during resource creation. You are advising the development and operations teams on how to re-architect their deployment pipeline workflow to adhere to Google Cloud security and operational best practices while enforcing least privilege and preventing state corruption. Which TWO recommendations should you provide?
- Configure Workload Identity Federation for the external CI/CD pipeline to authenticate to Google Cloud using short-lived tokens instead of service account keys.Answer
- Migrate Terraform state files to a Cloud Storage backend with object versioning and state locking enabled using Cloud Spanner or Cloud Storage native locks.Answer
- CGrant the CI/CD pipeline service account the Project Owner primitive role at the GCP Organization root level so that upcoming infrastructure expansions do not fail due to missing IAM permissions.
- DCommit Terraform state files into the application's version-controlled Git repository alongside code commits so that developers can track infrastructure changes during pull requests.
- EAssign developers the Service Account Admin role so they can generate and download local service account keys whenever pipeline execution fails.
Answer
The correct recommendations are configuring Workload Identity Federation for external CI/CD pipelines to eliminate service account JSON keys, and migrating Terraform state management to a Cloud Storage remote backend with versioning and state locking.
Configuring Workload Identity Federation replaces vulnerable long-lived service account JSON keys with short-lived, auto-expiring OIDC credentials for external pipelines. Moving Terraform state to a remote Cloud Storage bucket with object versioning and state locking prevents concurrent pipeline runs from corrupting infrastructure state and ensures state history is safely maintained.
Step-by-Step Solution
Key Concept
Advising Development and Operation Teams on Secure CI/CD Automation and IaC State Governance