A global logistics enterprise provisions its multi-project Google Cloud environment using Terraform managed through an automated external CI/CD pipeline. Security policy strictly forbids generating and storing long-lived service account JSON keys in CI/CD secrets. Additionally, operational guidelines mandate that Terraform state files are fully protected against concurrent pipeline execution conflicts and that previous state versions are preserved for recovery in case of state corruption. Which implementation strategy meets all security and operational requirements?
- Authenticate the CI/CD pipeline using Workload Identity Federation to impersonate a fine-grained service account, and store the state file in a Google Cloud Storage bucket with Object Versioning enabled using the native GCS backend.Cevap
- BAuthenticate the CI/CD pipeline using a service account assigned the Editor primitive role, and store the Terraform state in a Cloud Storage bucket with uniform bucket-level access and Object Versioning disabled to reduce storage overhead.
- CStore the Terraform state file directly inside the version-controlled CI/CD Git repository workspace, and dynamically generate temporary service account JSON keys at the start of each pipeline execution job.
- DAuthenticate the pipeline via Workload Identity Federation, but configure the deployment script to perform manual resource updates via gcloud commands whenever state locking fails to resolve state lock contention.
Cevap
Authenticate the CI/CD pipeline using Workload Identity Federation to impersonate a fine-grained service account, and store the state file in a Google Cloud Storage bucket with Object Versioning enabled using the native GCS backend.
Workload Identity Federation allows external CI/CD workloads to impersonate GCP service accounts securely using short-lived tokens, fulfilling keyless security requirements. Cloud Storage (GCS) backend provides native state locking to prevent concurrent modifications and Object Versioning preserves historical state revisions for disaster recovery.
Adım Adım Çözüm
Anahtar Kavram
Keyless authentication with Workload Identity Federation and GCS remote backend state locking/versioning