Skip to content

build(terraform): validate tf/ and move aws, kubernetes, helm #5076

Not planned

Description

@dan-petty

Problem or Motivation

The OpenTofu roots in tf/ pin three providers one major behind. Renovate (#4893) will offer them:

Provider Pin Newest Files
hashicorp/aws ~> 5.0 6.73 tf/aws/versions.tf
hashicorp/kubernetes ~> 2.30 3.5 tf/aws, tf/azure, tf/gcp versions.tf
hashicorp/helm ~> 2.13 3.3 tf/aws, tf/azure, tf/gcp versions.tf

By the upgrade guides, each needs only the pin:

  • aws v6: region on most resources, removed endpoints, aws_eip vpc removed (tf/aws uses domain = "vpc"), aws_eks_addon resolve_conflicts removed (not used). No resource that tf/aws uses (vpc, internet_gateway, subnet, eip, nat_gateway, route_table and its association, iam_role, iam_role_policy_attachment, eks_cluster, eks_node_group) is in the guide.
  • kubernetes 3.0.0 removes the deprecated resources without _v1 and changes the env handling of kubernetes_manifest. tf/ declares the provider but has no provider block, resource or data source of it.
  • helm v3: Plugin Framework (OpenTofu >= 1.0), kubernetes becomes an attribute, set, set_list and set_sensitive become lists. tf/ declares the provider but has no provider block, helm_release or helm_template.

But no project check proves it: no CI job runs tofu validate on tf/, and tofu is not installed in the devcontainer. So the baseline (#5065) left these pins as they are.

Research of 2026-11-12 (research-ci, records tofu:hashicorp/aws, tofu:hashicorp/kubernetes, tofu:hashicorp/helm).

Proposed Solution & Architectural Design

  • Add a check that runs tofu init -backend=false && tofu validate on each root of tf/ (a CI job or a devops ci row, with OpenTofu from its pinned release), so a provider update has a check.
  • Then set aws ~> 6.73, kubernetes ~> 3.5 and helm ~> 3.3, and show that the check passes.

Done when a check validates tf/ and the three pins are at the new majors.

Target Subsystem

OpenTofu / Infrastructure as Code

Existing Tool Considered

OpenTofu (tofu validate); the setup-opentofu action or the tools lock installs it. No new code beyond the check wiring.

Source: #4893

Alternatives check of 2026-11-22: in-use.
The repository already uses this tool.
Tool: opentofu/opentofu (https://github.com/opentofu/opentofu), MPL-2.0, last activity 2026-11-21, maintained.
Reason: Searches found no separate validator: OpenTofu's own tofu init -backend=false plus tofu validate checks each root against the pinned provider schemas, and the project already installs that binary from the tools lock, so only the row wiring is missing.

Covers:

  • Installs provider schemas per root with no state backend
  • Validates every tf/ root against those schemas
  • Runs from one exact version already in the tools lock

Lacks:

  • Does not edit the three provider pins itself
  • No plan or apply checks without cloud credentials
  • No style or security linting; tflint is separate

Proposed design

Problem statement

The OpenTofu roots in tf/ pin three providers one major behind the newest releases: aws ~> 5.0, kubernetes ~> 2.30 and helm ~> 2.13. The Static Analysis job installs the pinned OpenTofu but runs no tofu init/tofu validate on tf/, so no project check proves that a bump is safe. This item adds that check and moves the three pins to ~> 6.73, ~> 3.5 and ~> 3.3.

Acceptance criteria

Requirement: tf roots validate in static analysis

The Static Analysis check SHALL run tofu init -backend=false and tofu validate on each directory under tf/ that holds a versions.tf.

Scenario: A root with a removed attribute fails the check

  • WHEN A root under tf/ pins a provider major that removes an attribute or a resource that the root uses
  • THEN The row exits non-zero for that root and the Static Analysis check reports failure.

Requirement: aws provider at the new major

tf/aws/versions.tf SHALL pin hashicorp/aws at ~> 6.73.

Scenario: The aws pin is read

  • WHEN A test reads the aws entry of the required_providers block in tf/aws/versions.tf
  • THEN It finds version = "~> 6.73".

Requirement: kubernetes and helm providers at the new majors

Each root under tf/ that declares hashicorp/kubernetes or hashicorp/helm SHALL pin them at ~> 3.5 and ~> 3.3.

Scenario: A declared provider keeps an old pin

  • WHEN A test reads the required_providers block of a root under tf/ that declares kubernetes or helm
  • THEN It finds version = "~> 3.5" for kubernetes and version = "~> 3.3" for helm.

Requirement: OpenTofu runs at the pinned release

The new check SHALL run the OpenTofu release that src/devops_cli/tools_lock/tools.lock pins.

Scenario: The check uses the tools-lock OpenTofu

  • WHEN A test reads the Static Analysis job and the [binary.tofu] entry of src/devops_cli/tools_lock/tools.lock
  • THEN The job installs tofu with devops install-tools --tool tofu, and the lock names one exact version, with no floating tag.

Requirement: a missing tofu fails the check

The new row SHALL exit non-zero and name tofu when no tofu binary is on PATH.

Scenario: tofu is not installed

  • WHEN The row runs on a host whose PATH holds no tofu
  • THEN It exits non-zero with a message that names tofu, and it does not report a pass.

Existing Tool Considered

OpenTofu (opentofu/opentofu, tofu init -backend=false and tofu validate). The alternatives check of 2026-11-15 gives the verdict in-use, and the repository already pins it: [binary.tofu] 1.13.9 at src/devops_cli/tools_lock/tools.lock:627, installed in the Static Analysis job by uv run devops install-tools --tool tofu --only-missing (.github/workflows/ci.yml:80) and in the devcontainer image (.devcontainer/Dockerfile:206). It lacks the check wiring: no CI job or devops ci row runs it on tf/ today, so the change adds one devops ci row and a thin tests/gate module that calls the pinned binary, not a reimplementation of the tool. It does not edit the three pins, so those stay a manual edit. It validates provider schemas only, not plan/apply-time behaviour without credentials, and it does not lint Terraform style or security (a separate tool, tflint, in #2427).

Key questions

  • Which check runs tofu validate on each root of tf/?: Add one tofu row to the existing Static Analysis job. The row runs tofu init -backend=false and tofu validate on each root of tf/. Do not add a new workflow job to the repository ruleset. (best practice) [sources: docs/adr/0004-ci-is-the-authoritative-gate.md:11, docs/SDLC.md:205, .github/workflows/ci.yml:80, src/devops_cli/commands/ci.py:844]
    • Chosen: A new row of Static Analysis. Static Analysis is already a required check and already installs the pinned OpenTofu, so the row gates the merge with no repository ruleset change. The docs and k8s rows set the precedent for a devops ci row.
    • Rejected: A new standalone workflow job added to the ruleset. It needs a repository ruleset change, and a ruleset is a repository setting that only a person changes.
    • Rejected: A pre-push hook only. The pre-push hook runs only the fast static checks. A hook does not gate the merge.
  • How does the new row install OpenTofu?: It uses the OpenTofu that the Static Analysis job already installs: uv run devops install-tools --tool tofu --only-missing at .github/workflows/ci.yml:80, from the [binary.tofu] entry at src/devops_cli/tools_lock/tools.lock:627 (version 1.13.9). The devcontainer image installs the same release at .devcontainer/Dockerfile:206. No opentofu/setup-opentofu action is needed; the earlier answer was wrong that the devcontainer does not install tofu. [sources: .github/workflows/ci.yml:80, src/devops_cli/tools_lock/tools.lock:627]
  • Does tofu init need the state backend?: No. None of the three roots declares a backend block: tf/aws/versions.tf, tf/azure/versions.tf and tf/gcp/versions.tf hold only required_version and required_providers. The row runs tofu init -backend=false, so it skips backend initialization and needs no state bucket and no credentials. (best practice) [sources: tf/aws/versions.tf, tf/azure/versions.tf, tf/gcp/versions.tf, src/devops_cli/tf/tf_plans.py:13, src/devops_cli/commands/tf.py:359]
    • Chosen: tofu init -backend=false. No root declares a backend, so the flag skips backend setup and needs no state bucket or credentials; it also stays safe if a root later gains a backend.
    • Rejected: tofu init with backend initialization. It initializes the local backend and would need credentials for any root that later gains a remote backend, which a pull request job does not have.
    • Rejected: tofu validate with no init. tofu validate reads the provider schemas that tofu init installs, so it fails with no init. The project's devops tf validate runs only tofu validate (src/devops_cli/commands/tf.py:359).
  • Does tf/aws use a resource or argument that aws provider v6 removes?: tf/aws uses the aws_eip.nat resource at tf/aws/main.tf:56, which sets domain = "vpc" at tf/aws/main.tf:57. That is not the removed vpc argument. The new validate row proves the rest of the schema, so no manual reading of the upgrade guide gates the bump. [sources: tf/aws/main.tf:56, tf/aws/main.tf:57, tf/aws/versions.tf]
  • Does the helm v3 provider need a newer OpenTofu than the roots declare?: No. tf/aws/versions.tf requires OpenTofu >= 1.6.0, and the helm v3 provider runs on the Plugin Framework, which needs OpenTofu 1.0 or later. [sources: tf/aws/versions.tf]

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/low
    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. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: OpenTofu is exactly the tool the issue asks for: tofu init -backend=false fetches the pinned providers (aws, kubernetes, helm are all in its registry) and tofu validate checks each root of tf/ against their schemas, so a major bump that removes an attribute or resource fails the check. The project already writes its GitHub settings as OpenTofu code (ADR 0026), so no new tool is introduced, only the CI wiring.

    The repository already uses this tool.

    Tool: opentofu/opentofu (https://github.com/opentofu/opentofu)

    • License: MPL-2.0
    • Last activity: 2026-11-13
    • Maintained: yes

    Covers:

    • tofu init -backend=false resolves the aws, kubernetes and helm provider pins from the registry without touching state
    • tofu validate statically checks every root of tf/ against the installed provider schemas, so a removed resource, attribute or argument (e.g. aws_eip vpc, kubernetes non-_v1 resources, helm v3 list arguments) fails the check
    • OpenTofu ships the aws, kubernetes and helm providers, so the three major bumps can be verified before merge
    • The setup-opentofu action installs a pinned OpenTofu release, so the same check runs in CI and in the devcontainer/tools lock

    Lacks:

    • No CI job or devops ci row exists yet; the check wiring still has to be added by the project
    • It does not edit the three pins itself; the ~> 6.73, ~> 3.5 and ~> 3.3 changes remain a manual edit
    • Validation is static only: it catches schema breakage but not plan/apply-time behaviour (e.g. the new aws v6 region requirement) without credentials and a plan
    • It does not lint Terraform style or security, which is a separate tool (tflint/dive in fix(security): tflint and dive are pinned in tools.lock, or their adapters and the tflint fallback go #2427)

    Tools considered:

    Searches run:

    • opentofu/setup-opentofu GitHub Action install pinned version, results: 5
    • OpenTofu tofu validate GitHub Actions CI check, results: 5
    • tofu init -backend=false tofu validate CI pipeline Terraform providers, results: 5
    • opentofu setup-opentofu action, results: 5
    • OpenTofu open source Terraform alternative, results: 5
    • tflint terraform linter GitHub Action, results: 5
    • tofu validate command documentation opentofu.org, results: 5
    • OpenTofu 1.x provider version upgrade validate configuration, results: 5
    • opentofu, 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.

  6. added
    status/ready
    and removed
    status/new
    on Nov 17, 2026
  7. devops-cli-service commented on Nov 17, 2026

    @devops-cli-service
    Contributor

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

  8. dan-petty commented on Nov 25, 2026

    @dan-petty
    OwnerAuthor

    Closed as not planned. The tf/ roots (tf/aws, tf/azure, tf/gcp) and src/devops_cli/tools_lock/tools.lock that this item targets were removed from dan-petty/devops-cli (#4363, and commit 7344d29e8 / #6767 / #6679 per ADR 0032 #6674). The OpenTofu examples and modules now live in dan-petty/infra, where tf/examples/aws/versions.tf already pins hashicorp/aws at 6.74.0 (dan-petty/infra#117), tf/modules/ declare no kubernetes or helm provider blocks, and dan-petty/infra's OpenTofu CI job runs tofu init -backend=false -input=false and tofu validate on each example.

  9. 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/lowpriority/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