Soru

Zorluk: OrtaProvisioning Storage and Database Systems

A global enterprise is establishing an automated Infrastructure as Code (IaC) pipeline to provision Cloud Spanner databases and Cloud Storage buckets across multiple operational regions. During automated CI/CD runs, concurrent pipeline executions occasionally attempt to modify the same environment simultaneously. The lead architect must ensure that remote Terraform state operations prevent race conditions and allow state recovery if accidental deletion occurs. Which provisioning approach best satisfies these requirements?

  1. Configure the Terraform backend to store the state file in a Google Cloud Storage bucket with Object Versioning enabled, allowing native object locking to manage concurrency.Cevap
  2. B
    Maintain state files in unversioned local runner storage and execute custom gcloud synchronization scripts at the end of every pipeline run.
  3. C
    Replace the global database requirement with regional Cloud SQL instances to avoid needing remote state locking during provisioning.
  4. D
    Encrypt the state storage bucket with Customer-Supplied Encryption Keys (CSEK) to automatically enforce single-writer access locks.

Cevap

The team should store the Terraform state in a Google Cloud Storage backend with Object Versioning enabled to leverage native state locking and preserve state history.
The correct strategy uses Google Cloud Storage as a remote Terraform backend with Object Versioning enabled. The GCS backend natively supports state locking using Google Cloud Storage object locking capabilities, ensuring that concurrent pipeline runs cannot mutate the state simultaneously while providing history recovery.

Adım Adım Çözüm

1
Identify the concurrency and recovery requirements for IaC database and storage provisioning.
The solution requires centralized state storage, concurrent execution protection, and state restoration capabilities.
Simultaneous pipeline executions can corrupt un-locked Terraform state files.
2
Evaluate Google Cloud Storage features for Terraform backend integration.
GCS provides native object locking support for Terraform state files and supports Object Versioning for point-in-time state recovery.
Native locking guarantees single-writer access during `terraform apply` operations without external lock tables.

Anahtar Kavram

Terraform State Management and Storage Backend Provisioning
Tahmini Süre:1m 30s
Bu soruyu puanla