Skip to content

build(terraform): move the google provider to 8.x #5075

Not planned

Description

@dan-petty

Problem or Motivation

tf/gcp/versions.tf pins the provider hashicorp/google at ~> 5.0. The newest is 8.11 (registry.opentofu.org), three majors later. Renovate (#4893) will offer them.

  • v6: the attribution label goog-terraform-provisioned goes on new resources; label fields change on google_container_cluster; empty-list forms are removed.
  • v7: import validation; enable_flow_logs of a subnetwork is removed.
  • v8: logging_config and monitoring_config enable_components of google_container_cluster become sets; node pool name_prefix.

tf/gcp sets none of the removed fields, but the three majors change the plan output and the defaults. No CI job runs tofu validate on tf/, and tofu is not installed in the devcontainer.

Research of 2026-11-12 (research-ci, record tofu:hashicorp/google).

Proposed Solution & Architectural Design

  • Set ~> 8.11 in tf/gcp/versions.tf; edit tf/gcp/main.tf where the guides require it.
  • Decide on the attribution label default (keep or turn off with add_terraform_attribution_label).
  • Run tofu init -backend=false && tofu validate in tf/gcp, and tofu plan against a test project if one exists. Record the output in the pull request.

Done when tofu validate passes on tf/gcp with google 8.11.

Target Subsystem

OpenTofu / Infrastructure as Code

Existing Tool Considered

OpenTofu (tofu validate, tofu plan) and the google provider upgrade guides. No new code.

Source: #4893

Alternatives check of 2026-11-22: none.
Tool: none found.
Reason: Searches found only tfupdate, which rewrites the version constraint that Renovate already offers, and the provider upgrade guides; nothing edits main.tf, decides the attribution label, or gates CI on tofu validate.

Lacks:

  • Rewrites only the version constraint line, which Renovate already bumps
  • Makes no provider block or main.tf edit
  • Runs no tofu init, validate or plan
  • Adds no required CI step and no validation gate

Proposed design

Problem statement

tf/gcp/versions.tf pins the provider hashicorp/google at ~> 5.0. The newest is 8.11, three majors later. The 6.x, 7.x and 8.x majors change the defaults and remove fields, and no check runs tofu validate on tf/. The change sets ~> 8.11, records the attribution-label choice, and makes tofu validate a CI gate.

Acceptance criteria

Requirement: Google provider constraint

tf/gcp/versions.tf SHALL pin the provider hashicorp/google at ~> 8.11.

Scenario: The google constraint is 8.11

  • WHEN a test reads the google entry of required_providers in tf/gcp/versions.tf
  • THEN the entry holds version = "~> 8.11".

Requirement: Attribution label is off

The google provider block in tf/gcp/main.tf SHALL set add_terraform_attribution_label = false.

Scenario: The provider block disables the attribution label

  • WHEN a test reads the google provider block in tf/gcp/main.tf
  • THEN the block holds add_terraform_attribution_label = false.

Requirement: No removed subnetwork field

tf/gcp/main.tf MUST NOT set enable_flow_logs on google_compute_subnetwork.

Scenario: The subnetwork sets no removed field

  • WHEN a test searches tf/gcp/main.tf for enable_flow_logs
  • THEN the search returns no match.

Requirement: CI runs the validation

The required Static Analysis check SHALL run tofu init -backend=false and tofu validate in tf/gcp.

Scenario: Static Analysis holds the tofu step

  • WHEN a test reads the workflow that defines the Static Analysis job
  • THEN the job holds a step that runs tofu init -backend=false and tofu validate in tf/gcp.

Requirement: The bump validates at 8.11

tf/gcp MUST pass tofu validate with hashicorp/google 8.11.

Scenario: Validate exits zero at 8.11

  • WHEN CI runs tofu validate in tf/gcp at the head of the pull request
  • THEN the command exits 0 and reports no error.

Existing Tool Considered

None: no open, maintained tool covers the need (alternatives check of 2026-11-15). The closest is minamijoyo/tfupdate (MIT, active 2026-10-26). It rewrites only the ~> 5.0 line in tf/gcp/versions.tf, and Renovate already offers that line. It makes no tf/gcp/main.tf edit, decides no attribution label, and runs no tofu init or tofu validate. The provider upgrade guides are documentation of the dependency, not a tool. The change builds no new code, so it has no build cost beyond the review of one constraint line, one provider argument and one CI step.

Key questions

  • Which removed or changed fields of the google 6.x, 7.x and 8.x majors does the tf/gcp configuration set?: None. google_compute_subnetwork.subnet sets no enable_flow_logs. google_container_cluster.gke sets no logging_config or monitoring_config. No resource assigns an empty list. google_container_node_pool.primary_nodes sets name, and it sets no name_prefix. [sources: tf/gcp/main.tf]
  • Does the google provider add the goog-terraform-provisioned attribution label to new resources?: No. Set add_terraform_attribution_label = false in the google provider block. The bump then adds no label to a resource, and resources created before and after the bump stay alike. (best practice) [sources: tf/gcp/main.tf]
    • Rejected: Keep the provider default and add the label. The provider adds the label only to resources created after the bump, so old and new resources would differ. No project decision asks for the label.
    • Chosen: Set add_terraform_attribution_label = false. The bump keeps the resource labels as they are. No project decision asks for a new label.
  • How does the change run tofu validate when no environment of the repository has tofu?: Add the run to the required Static Analysis check. The check installs OpenTofu and runs tofu init -backend=false and tofu validate in tf/gcp. If google 8.11 needs a floor above >= 1.6.0, the same pull request raises required_version. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md, tf/gcp/versions.tf]
    • Rejected: Run tofu validate by hand and paste the output in the pull request. No environment of the job has tofu, and a pasted output is no repeatable gate.
    • Chosen: Add the run to the required Static Analysis check. CI is the authoritative gate (ADR 0004). The check blocks a merge and repeats on each change.
    • Rejected: Add a new CI job for tf/ and make it a required check. A new required check needs a change of the main ruleset, and only a person makes that change. The required Static Analysis check gates now.
    • Rejected: Ship the bump with no validation. A major version bump would merge unverified.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    on Nov 12, 2026
  2. added
    type/infra
    scope/terraform
    status/new
    value/medium
    effort/medium
    on Nov 12, 2026
  3. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor
  4. added
    priority/p2-medium
    on Nov 12, 2026
  5. removed
    priority/p2-medium
    on Nov 12, 2026
  6. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor
  7. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Alternatives check: none

    Reason: Searches for the google provider 8.x upgrade and for a tool that bumps Terraform provider constraints returned only generic Terraform/OpenTofu container images and no tool that migrates a provider major version. The closest open tool, tfupdate, only rewrites a version constraint string (a line Renovate already offers, per the issue), and leaves the main.tf edits the upgrade guides require, the attribution-label decision and the tofu validate/plan run to the project's own configuration, so nothing covers the need.

    Tool: none found

    Lacks:

    • No tool migrates the configuration across the v6/v7/v8 breaking changes (label fields, removed empty-list forms, import validation, enable_flow_logs, enable_components sets, node pool name_prefix)
    • No tool decides the add_terraform_attribution_label default or rewrites tf/gcp/main.tf accordingly
    • tfupdate rewrites only the ~> 5.0 constraint in tf/gcp/versions.tf; it runs no tofu init -backend=false, tofu validate or tofu plan and adds no CI check
    • The provider upgrade guides are documentation of the dependency, not a tool that performs the upgrade

    Tools considered:

    Searches run:

    • hashicorp/google terraform provider 8.0 upgrade guide breaking changes, results: 5
    • tool to update terraform provider version constraints automatically tfupdate, results: 5
    • minamijoyo/tfupdate update version constraint Terraform provider, results: 5
    • terraform-google-modules provider upgrade 5 to 8 migration guide labels goog-terraform-provisioned, results: 5
    • renovate bot terraform provider version bump pull request, results: 5
    • github hashicorp terraform-provider-google upgrade guides v8 google_container_cluster, results: 5

    Sources:

    Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    status/ready
    and removed
    status/new
    on Nov 16, 2026
  9. devops-cli-service commented on Nov 16, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 3355a77 (see proposed design in issue body).

    Moved to new items: dan-petty/infra#184.

  10. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Closed as not planned. The hand-written tf/gcp configuration that this item updates was removed from dan-petty/devops-cli by commit 7344d29e8 (#6767, Closes dan-petty/devops-cli#6679) per ADR 0032 (#6674). The GCP OpenTofu example and module now live in dan-petty/infra (tf/examples/gcp, tf/modules/gcp-gke), where tf/examples/gcp/versions.tf already pins hashicorp/google at 8.12.0 (required_version >= 1.17.2) and dan-petty/infra's OpenTofu CI job runs tofu init -backend=false -input=false and tofu validate.

  11. removed
    status/ready
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/mediumpriority/p2-mediumscope/terraformsource/agenttype/infravalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions