Question

Difficulty: MediumBuilding and Managing Infrastructure as Code (IaC)

An enterprise logistics firm manages its Google Cloud infrastructure using Terraform across multiple environments. The cloud architecture team must secure the automated deployment pipeline, enforce least-privilege access control, and protect against state file corruption and configuration drift. Which TWO actions should the engineering team implement to meet these requirements? (Select TWO.)

  1. Configure a Cloud Storage bucket with Object Versioning enabled as the remote backend to store the Terraform state file securely.Answer
  2. Use Workload Identity Federation with fine-grained IAM roles to authenticate the CI/CD runner to Google Cloud without storing long-lived service account keys.Answer
  3. C
    Store the Terraform state file locally on the CI/CD build worker disk to eliminate cloud network latency during execution.
  4. D
    Assign the primitive Owner IAM role to the service account used by the CI/CD pipeline to prevent permission errors during deployment.
  5. E
    Apply critical infrastructure changes manually in the Google Cloud Console first and skip modifying Terraform configurations to save operational time.

Answer

The engineering team should configure a Cloud Storage bucket with Object Versioning as the remote backend and authenticate the CI/CD pipeline using Workload Identity Federation with fine-grained IAM roles.
Configuring a Cloud Storage bucket with Object Versioning provides remote backend state locking, concurrency protection, and version recovery. Utilizing Workload Identity Federation with fine-grained IAM roles allows the CI/CD pipeline to authenticate securely without storing static service account keys while enforcing least-privilege security.

Step-by-Step Solution

1
Establish secure remote state management
Configure Terraform to use a Cloud Storage backend with Object Versioning and state locking.
This prevents concurrent state modifications and enables state history recovery in case of corruption.
2
Secure pipeline authentication and authorization
Implement Workload Identity Federation with short-lived tokens and fine-grained custom or predefined IAM roles.
This eliminates long-lived service account key security risks and ensures least privilege access.

Key Concept

Terraform Remote State Backend Security and CI/CD Keyless Authentication
Rate this question