Soru

Zorluk: KolayDeploying Infrastructure using Deployment Manager or Terraform

A cloud engineering team wants to store Terraform state files remotely in Google Cloud to support team collaboration and state locking. Which TWO steps are required to configure a Cloud Storage bucket as a remote backend for Terraform?

  1. Create a Cloud Storage bucket in Google Cloud to store the Terraform state file.Cevap
  2. Add a `backend "gcs"` block inside the Terraform configuration and specify the bucket name.Cevap
  3. C
    Enable the Cloud Monitoring API in the organization root project to initialize state locking.
  4. D
    Generate and export long-lived JSON service account keys to be committed into the shared source repository.

Cevap

The two required steps are creating a Cloud Storage bucket in Google Cloud to host the state file, and defining a `backend "gcs"` configuration block specifying that bucket.
To set up a remote state backend in Google Cloud using Terraform, you must create a GCS bucket and configure the `backend "gcs"` block in your Terraform configuration files before executing `terraform init`.

Adım Adım Çözüm

1
Provision remote storage
A Google Cloud Storage bucket exists to store state.
Terraform needs an target storage location in GCP before remote initialization.
2
Define backend configuration
A `terraform { backend "gcs" { bucket = "..." } }` block is added to code.
This instructs Terraform CLI to migrate local state to GCS when running `terraform init`.

Anahtar Kavram

Configuring Cloud Storage (GCS) as a remote backend for Terraform state
Bu soruyu puanla