Soru

Zorluk: OrtaDeploying Infrastructure using Deployment Manager or Terraform

A platform engineering team is setting up Terraform to manage Google Cloud networking infrastructure across multiple developer environments. To adhere to security best practices, the team wants to centrally store state files with automatic state locking while eliminating the risk of exposed long-lived service account credentials on local engineer workstations. Which TWO configuration steps should the team perform to fulfill these requirements? (Select TWO)

  1. Define a `backend "gcs"` block inside the Terraform configuration referencing a central Cloud Storage bucket, and run `terraform init`.Cevap
  2. Configure `impersonate_service_account` in the Terraform Google provider block to allow engineers to authenticate using their individual Google user credentials.Cevap
  3. C
    Generate long-lived JSON service account keys for each developer and set the `credentials` parameter inside the Terraform Google provider configuration.
  4. D
    Execute `gsutil terraform sync` prior to every deployment to upload local state files to the designated Cloud Storage bucket.

Cevap

The team should configure a `backend "gcs"` block in the Terraform configuration followed by executing `terraform init`, and configure service account impersonation using `impersonate_service_account` in the Google provider configuration.
Configuring the `backend "gcs"` block with `terraform init` provisions centralized, state-locked storage in Google Cloud Storage. Utilizing `impersonate_service_account` within the Google provider ensures engineers authenticate via short-lived tokens without storing sensitive JSON private key files locally.

Adım Adım Çözüm

1
Configure remote state storage using Google Cloud Storage.
Specifying `backend "gcs"` and executing `terraform init` migrates the local state file to Cloud Storage and enables state locking.
Centralizing state storage prevents state file conflicts across team members and ensures consistent infrastructure state tracking.
2
Configure short-lived credential access using IAM impersonation.
Adding `impersonate_service_account` to the Google provider configuration allows users to assume service account permissions dynamically.
Impersonation eliminates the requirement to generate and store static service account JSON keys on local disk.

Anahtar Kavram

Terraform Remote Backend and Service Account Impersonation in Google Cloud
Bu soruyu puanla