Soru

Zorluk: KolayBuilding and Managing Infrastructure as Code (IaC)

A DevOps team is configuring Terraform to manage Google Cloud infrastructure for a new application environment. To prevent simultaneous deployments from causing state file corruption and concurrency conflicts, what is the Google Cloud recommended practice for managing the Terraform state backend?

  1. Configure a central Google Cloud Storage (GCS) bucket backend with object versioning enabled to support automatic state locking.Cevap
  2. B
    Store state files in an unversioned local directory shared via a network drive so engineers can inspect state files offline.
  3. C
    Grant the Owner primitive IAM role to CI/CD service accounts to allow automated pipelines to override state locking errors.
  4. D
    Apply modifications manually using the Google Cloud Console whenever concurrent Terraform runs encounter state lock failures.

Cevap

Configure a central Google Cloud Storage (GCS) bucket backend with object versioning enabled to support automatic state locking.
Configuring a Google Cloud Storage (GCS) bucket as a remote backend allows Terraform to utilize GCS object lock features to block concurrent updates while keeping historical versions of state for disaster recovery.

Adım Adım Çözüm

1
Identify the primary operational requirement for multi-user Infrastructure as Code (IaC) deployment.
Recognize that concurrent executions require state locking and historical recovery capabilities.
Without state locking, simultaneous Terraform apply operations can cause race conditions and state corruption.
2
Evaluate Google Cloud backend options for Terraform.
Select Google Cloud Storage (GCS) as the official remote backend.
GCS provides native object locking via strong consistency and object versioning for rollback capabilities.

Anahtar Kavram

Terraform Remote Backend and State Locking in Google Cloud Storage
Bu soruyu puanla