Question

Difficulty: EasyImplementing Infrastructure as Code using Terraform and Deployment Manager

A Cloud Architecture team is setting up Terraform for multi-developer infrastructure provisioning on Google Cloud. They need to ensure safe state collaboration, avoid state corruption during concurrent updates, and preserve historical state versions. Which backend architecture should the team implement to adhere to Google Cloud best practices?

  1. Configure the Terraform backend to use a Google Cloud Storage bucket with object versioning enabled to support remote state locking and recovery.Answer
  2. B
    Store the Terraform state files on an unversioned shared local disk attached to a Compute Engine virtual machine.
  3. C
    Assign the primitive Owner role to the deployment service account to ensure unblocked state updates across all resources.
  4. D
    Grant developers the Service Account Admin role to allow service account key management during Terraform execution.

Answer

Configure the Terraform backend to use a Google Cloud Storage bucket with object versioning enabled.
Using a Google Cloud Storage bucket with object versioning enabled as the Terraform remote backend is the recommended standard. It provides state locking natively to prevent concurrent executions from corrupting state, while object versioning enables easy recovery if a state file becomes corrupted or accidentally overwritten.

Step-by-Step Solution

1
Identify the requirements for collaborative Terraform infrastructure management.
Requirements are central remote state storage, automated locking during concurrent executions, and version history for state recovery.
Team deployments require centralized state management to prevent race conditions and accidental data loss.
2
Evaluate Google Cloud Storage (GCS) backend capabilities for Terraform.
The GCS backend automatically leverages Cloud Storage object locking while bucket versioning preserves previous state snapshots.
This aligns directly with Google Cloud operational and security best practices for Infrastructure as Code.

Key Concept

Terraform Remote State Management with Cloud Storage
Rate this question