Terraform + Google Cloud

Terraform (or its open-source fork OpenTofu) provisioning Google Cloud projects, IAM, networking and services through the google and google-beta providers.

  • TerraformTerraform
  • Google CloudGoogle Cloud
Learning curve
Moderate
Status
Actively developed
Reviewed
November 2026
Best for
  • Project factories that create GCP projects with billing, APIs, IAM and networking in one pass
  • Organisations governing IAM and organisation policies centrally across folders
  • GKE, Cloud Run and Cloud SQL environments replicated across dev, staging and production
  • Data platforms built from BigQuery datasets, Pub/Sub topics and Cloud Storage buckets
Not ideal for
  • Per-commit application deploys

Overview

This stack manages Google Cloud with Terraform's `google` provider, plus `google-beta` for features still in preview. Google's resource hierarchy (organisation, folders, projects) maps cleanly onto Terraform modules, and state usually lives in a Cloud Storage bucket whose backend locks natively. Google publishes its own Terraform guides and module sets and offers Infrastructure Manager as a managed way to run it. Teams use it to create projects consistently, govern IAM centrally and stand up GKE, Cloud Run and Cloud SQL environments.

What's inside

HCL is quick to learn; the difficulty is GCP's model (projects versus folders, service accounts and service agents, IAM inheritance, shared VPC and API enablement) and decoding permission errors during apply.

  • Terraform

    Terraform

    Infrastructure

    Hosts, deploys or connects the system

    Learning: Easy

    Status: Active

  • Google Cloud

    Google Cloud

    Infrastructure

    Hosts, deploys or connects the system

    Learning: Moderate

    Status: Active

How it works

Terraform authenticates with Application Default Credentials or an impersonated service account, plans against state stored in Cloud Storage, and calls Google Cloud's REST APIs, polling long-running operations until each resource is ready.

  1. 1.

    Other to infrastructure

    Terraform or OpenTofu loads HCL modules, often from terraform-google-modules or Cloud Foundation Fabric, and initialises the `gcs` backend, which locks state with a lock object in the bucket.

  2. 2.

    Infrastructure to infrastructure

    The `google` provider gets credentials from Application Default Credentials, service account impersonation, or Workload Identity Federation in CI such as GitHub Actions: avoiding long-lived JSON keys.

  3. 3.

    Infrastructure to infrastructure

    `terraform plan` refreshes existing resources through Google's REST APIs and diffs them against configuration; resources that need preview fields are routed to the `google-beta` provider.

  4. 4.

    Infrastructure to infrastructure

    `terraform apply` walks the dependency graph (`google_project`, billing link, `google_project_service` API enablement, then VPCs, GKE clusters or Cloud SQL) polling long-running operations as it goes.

  5. 5.

    Infrastructure to infrastructure

    Organisation policy constraints and IAM are enforced by Google at apply time, so violations surface as API errors rather than at plan; the new state is written back to the versioned GCS bucket.

Strengths and drawbacks

Strengths

  • Resource hierarchy maps to modules

    Organisation, folder and project boundaries give natural units for modules and state files, and a project-per-environment layout keeps blast radius and IAM scoped.

  • Locking built into the GCS backend

    The `gcs` backend locks state without a separate lock table, and bucket object versioning gives a simple recovery path after a bad state write.

  • Keyless authentication

    Service account impersonation and Workload Identity Federation let engineers and pipelines run Terraform without downloading service account keys, which Google advises against.

  • Google-maintained modules and guidance

    Google publishes Terraform best-practice docs and the terraform-google-modules and Cloud Foundation Fabric module sets, covering project factories, shared VPC and landing zones.

Drawbacks

  • API enablement and eventual consistency

    Each service API must be enabled per project (`google_project_service`) before its resources exist, and freshly enabled APIs or IAM grants take time to propagate, so first applies often fail and pass on retry.

  • Authoritative IAM resources can lock you out

    `google_project_iam_policy` replaces a project's entire IAM policy and `_binding` replaces every member of a role, removing grants made elsewhere, including Google-managed service agents. Most teams use additive `_member` resources unless they deliberately want full control.

  • The google and google-beta split

    Preview features exist only in `google-beta`; mixing providers per resource works but doubles version pinning and upgrade work, and beta fields can change before GA.

  • Smaller community than AWS

    There are fewer third-party modules, examples and answered questions than for AWS, so teams more often write their own modules or adopt Google's opinionated Fabric code.

  • Licence and tool choice

    Terraform has been under the Business Source License since 2023 and OpenTofu is the MPL-licensed fork; check which Terraform versions Infrastructure Manager and your CI runners support before standardising.

Scores

Editorial ratings out of 10, comparable across every stack in the guide. They are judgement, not benchmarks. How we score

Speed of building
7.2 out of 10, catalog average 7.7

How quickly a team ships features

Ease of learning
7.0 out of 10, catalog average 7.2

Higher means easier to pick up

Scalability
8.8 out of 10, catalog average 7.6

How far it grows before a redesign

Performance
7.8 out of 10, catalog average 7.5

Speed of the running application

Maintainability
7.6 out of 10, catalog average 7.2

How well the codebase ages

Ecosystem
7.8 out of 10, catalog average 8.2

Libraries, hosting, docs and hiring

Flexibility
8.0 out of 10, catalog average 7.4

How many kinds of product it suits

How it scales

Scales from one project to organisation-wide estates by splitting state per folder, project and environment, typically behind a project factory and CI-driven applies.

Starting outMVP and first users
One or two projects managed from a single repository with a GCS backend, applied by an engineer through an impersonated service account.
GrowingReal traffic, a few engineers
Separate state per environment, a shared VPC host project with service projects, and Cloud Build or GitHub Actions running plans on pull requests via Workload Identity Federation.
LargeHeavy traffic or data
A project factory module creating projects with billing, APIs, IAM and budgets; folder-level organisation policies; Atlantis, HCP Terraform or Infrastructure Manager running applies.
EnterpriseMany teams and regions
A landing zone built on Cloud Foundation Fabric FAST or similar, with separate pipelines and service accounts per stage (bootstrap, resource hierarchy, networking, security) and policy checks on plans.

Where it fits

Common projects, from best fit to worst.

  • Project factory and organisation bootstrap

    New projects arrive with billing, enabled APIs, labels, budgets, IAM groups and shared VPC attachment from one reviewed pull request.

    Great fit

  • GKE and cloud run environments

    Clusters, node pools, Artifact Registry and Cloud Run services defined per environment; `deletion_protection` on GKE clusters and Cloud SQL instances must be switched off explicitly before Terraform can destroy them.

    Great fit

  • BigQuery data platform

    Datasets, IAM, Pub/Sub and storage are managed well as code; frequently evolving table schemas are often better left to the data team's own tooling such as dbt.

    Good fit

  • Per-commit application deploys

    Rolling out new Cloud Run revisions or container images on every commit fits `gcloud`, Cloud Deploy or GitOps better than full Terraform plans.

    Poor fit

Alternatives

Similar stacks, and when you would choose them instead.

Sources

Reviewed on November 19, 2026 against the documentation below. Found something out of date? Suggest a correction. Read our methodology.

Stacks that share technologies with Terraform + Google Cloud.