Repository navigation
Description
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:
regionon most resources, removed endpoints,aws_eipvpcremoved (tf/awsusesdomain = "vpc"),aws_eks_addonresolve_conflictsremoved (not used). No resource thattf/awsuses (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
_v1and changes the env handling ofkubernetes_manifest.tf/declares the provider but has no provider block, resource or data source of it. - helm v3: Plugin Framework (OpenTofu >= 1.0),
kubernetesbecomes an attribute,set,set_listandset_sensitivebecome lists.tf/declares the provider but has no provider block,helm_releaseorhelm_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 validateon each root oftf/(a CI job or adevops cirow, with OpenTofu from its pinned release), so a provider update has a check. - Then set aws
~> 6.73, kubernetes~> 3.5and 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 Analysischeck 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
awsentry of therequired_providersblock intf/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_providersblock of a root undertf/that declareskubernetesorhelm - THEN It finds
version = "~> 3.5"forkubernetesandversion = "~> 3.3"forhelm.
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 Analysisjob and the[binary.tofu]entry ofsrc/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
PATHholds notofu - 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 validateon each root oftf/?: Add onetofurow to the existingStatic Analysisjob. The row runstofu init -backend=falseandtofu validateon each root oftf/. 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 Analysisis already a required check and already installs the pinned OpenTofu, so the row gates the merge with no repository ruleset change. Thedocsandk8srows set the precedent for adevops cirow. - 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.
- Chosen: A new row of
- How does the new row install OpenTofu?: It uses the OpenTofu that the
Static Analysisjob already installs:uv run devops install-tools --tool tofu --only-missingat.github/workflows/ci.yml:80, from the[binary.tofu]entry atsrc/devops_cli/tools_lock/tools.lock:627(version 1.13.9). The devcontainer image installs the same release at.devcontainer/Dockerfile:206. Noopentofu/setup-opentofuaction is needed; the earlier answer was wrong that the devcontainer does not installtofu. [sources: .github/workflows/ci.yml:80, src/devops_cli/tools_lock/tools.lock:627] - Does
tofu initneed the state backend?: No. None of the three roots declares a backend block:tf/aws/versions.tf,tf/azure/versions.tfandtf/gcp/versions.tfhold onlyrequired_versionandrequired_providers. The row runstofu 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 initwith 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 validatewith no init.tofu validatereads the provider schemas thattofu initinstalls, so it fails with no init. The project'sdevops tf validateruns onlytofu validate(src/devops_cli/commands/tf.py:359).
- Chosen:
- Does
tf/awsuse a resource or argument that aws provider v6 removes?:tf/awsuses theaws_eip.natresource attf/aws/main.tf:56, which setsdomain = "vpc"attf/aws/main.tf:57. That is not the removedvpcargument. 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.tfrequires 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
dan-petty commentedon Nov 12, 2026
Both deal with Terraform tooling in the devcontainer and tools.lock, but #2427 installs tflint and dive for security scanning while this adds a tofu validate check and upgrades three provider pins.build(deps): take every safe version update before Renovate (#5102)
devops-cli-service commentedon Nov 15, 2026
Alternatives check: in-use
Reason: OpenTofu is exactly the tool the issue asks for:
tofu init -backend=falsefetches the pinned providers (aws, kubernetes, helm are all in its registry) andtofu validatechecks each root oftf/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)
Covers:
tofu init -backend=falseresolves the aws, kubernetes and helm provider pins from the registry without touching statetofu validatestatically checks every root oftf/against the installed provider schemas, so a removed resource, attribute or argument (e.g.aws_eipvpc,kubernetesnon-_v1resources, helm v3 list arguments) fails the checkLacks:
devops cirow exists yet; the check wiring still has to be added by the project~> 6.73,~> 3.5and~> 3.3changes remain a manual editregionrequirement) without credentials and a planTools considered:
Searches run:
Sources:
Checked on 2026-11-15. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Status set to Ready at e04435a (see proposed design in issue body).
dan-petty commentedon Nov 25, 2026
Closed as not planned. The
tf/roots (tf/aws,tf/azure,tf/gcp) andsrc/devops_cli/tools_lock/tools.lockthat this item targets were removed fromdan-petty/devops-cli(#4363, and commit7344d29e8/#6767/#6679per ADR 0032#6674). The OpenTofu examples and modules now live indan-petty/infra, wheretf/examples/aws/versions.tfalready pinshashicorp/awsat6.74.0(dan-petty/infra#117),tf/modules/declare nokubernetesorhelmprovider blocks, anddan-petty/infra'sOpenTofuCI job runstofu init -backend=false -input=falseandtofu validateon each example.