terraform-gcp
Terraform GCP
Provision and manage Google Cloud Platform infrastructure using Terraform with the hashicorp/google provider.
When to Use
- Defining GCP infrastructure as code for repeatable, auditable deployments
- Managing multi-environment setups (dev, staging, production) from a single codebase
- Provisioning complex resource graphs (VPC + GKE + Cloud SQL + IAM) in one plan
- Integrating infrastructure changes into CI/CD pipelines with plan/apply stages
Examples are partial modules and require complete variable declarations, subnet CIDRs, API enablement dependencies, private service networking connection/outputs and provider-compatible schemas before planning. HCL attributes use newlines, not semicolon separators. Confirm project/backend/workspace, cost and saved-plan changes before apply; protect state and plan files because generated passwords remain in state despite sensitive flags. Prefer workload identity/short-lived CI credentials over service account key files. Private GKE nodes do not imply a private control-plane endpoint; explicitly configure endpoint access. A force-new property cannot generally be fixed with state mv; use moved/state operations only for a true address refactor of the same resource.
Prerequisites
- Terraform >= 1.5 installed
- Google Cloud SDK or a service account key for CI
- A GCP project with billing enabled