Repository navigation
Description
Split from #5074.
Problem: no check validates tf/. The devops ci gate holds 26 rows and none runs tofu validate (src/devops_cli/commands/ci.py:120), as the archived proposal of #5065 records. Issue #5074 moves tf/azure to azurerm ~> 5.13 and runs tofu init -backend=false && tofu validate by hand, but nothing fails when a later edit breaks the provider schema. OpenTofu 1.13.9 is already in the devcontainer image (.devcontainer/Dockerfile:206) and the static CI job installs it (.github/workflows/ci.yml:80), so no image change is needed. Why deferred: the gate is a new row of devops ci (code in src/devops_cli/commands/ci.py) or a new workflow step, and it needs a committed tf/azure/.terraform.lock.hcl plus a time budget inside the static job's 6 minutes (.github/workflows/ci.yml:51). Issue #5074 keeps the pin, the guide edits and the offline tests. Acceptance criteria: - tf/azure/.terraform.lock.hcl pins hashicorp/azurerm 5.13 with the checksums of the provider builds. - A check runs tofu init -backend=false and then tofu validate in tf/azure and fails when the configuration does not match the provider schema. - The check needs no Azure credentials. - The static job stays under its 6-minute timeout. tofu plan against a real subscription stays out of scope: it needs a test subscription that a person provides.
Proposed design
Problem statement
tf/azure has no CI check. The devops ci registry holds no OpenTofu row, so an edit that breaks the provider schema passes every gate. Add a tofu row that runs tofu init -backend=false and tofu validate in tf/azure, commit the azurerm 5.13 lock file, and fail when init changes the lock file. The row needs no Azure credential and stays inside the static job's 6-minute timeout. It waits on #5074 for the azurerm 5.13 pin.
Acceptance criteria
Requirement: The tofu row joins the gate registry
The devops ci check registry SHALL hold a tofu row whose command runs the main of tests/gate/tofu_validate.py, and CHECK_ROW_NAMES SHALL name tofu in registry order.
Scenario: The row is in the registry
- WHEN the row registry test reads
CHECK_ROW_NAMESand thetofucheck spec - THEN it finds
tofuinCHECK_ROW_NAMESand the commanduv run python -cwithCONST_GATE_ROW_SCRIPTfortofu_validate
Requirement: The row runs init and validate in tf/azure
The tofu row MUST run tofu init -backend=false and then tofu validate, each with tf/azure as the working directory, and MUST fail when either command exits non-zero.
Scenario: A fake tofu records the two commands
- WHEN the gate module runs with a fake
tofuonPATHthat records its argv and working directory and exits 0 - THEN the module returns 0 and the fake holds
['tofu', 'init', '-backend=false']and['tofu', 'validate'], both run intf/azure
Requirement: The row fails when validate rejects the configuration
The tofu row MUST return a non-zero exit code when tofu validate exits non-zero.
Scenario: A fake tofu validate fails
- WHEN the gate module runs with a fake
tofuwhosevalidateexits 1 - THEN the module returns 1 and prints the failed
tofu validatecommand
Requirement: The row refuses a missing lock file
The tofu row SHALL fail with a finding that names tf/azure/.terraform.lock.hcl when that file is absent before tofu init.
Scenario: The lock file is absent
- WHEN the gate module runs in a tree with no
tf/azure/.terraform.lock.hcl - THEN the module returns 1 and prints
tf/azure/.terraform.lock.hcl is missing: run tofu init and commit the file
Requirement: The row refuses a changed lock file
The tofu row SHALL fail with a finding that names tf/azure/.terraform.lock.hcl when its bytes change during tofu init.
Scenario: init rewrites the lock file
- WHEN the fake
tofu initappends a checksum totf/azure/.terraform.lock.hcland exits 0 - THEN the module returns 1 and prints
tf/azure/.terraform.lock.hcl changed during tofu init: commit the file that tofu wrote
Requirement: The row needs no Azure credential
The tofu row SHALL pass on a host that holds no Azure credential, because tofu init -backend=false reads no backend and tofu validate makes no cloud API call.
Scenario: The static job runs the row without a credential
- WHEN
uv run devops ci --check --only tofuruns in theStatic Analysisjob - THEN the row exits 0 and its output names no
ARM_*orAZURE_*variable
Requirement: The row fits the static job
The tofu row SHALL set timeout_seconds to 120, under the static job's 6-minute timeout.
Scenario: The row bound is 120 seconds
- WHEN the row registry test reads the
timeout_secondsof thetofucheck spec - THEN the test asserts the value is 120
Requirement: The lock file pins azurerm 5.13
tf/azure/.terraform.lock.hcl MUST be committed with the checksums of hashicorp/azurerm 5.13 for linux_amd64.
Scenario: The gate row keeps the committed lock file
- WHEN
uv run devops ci --check --only tofuruns on theubuntu-26.04runner - THEN the row passes with
tf/azure/.terraform.lock.hclunchanged
Requirement: The static job caches the provider directory
The Static Analysis job SHALL cache the OpenTofu provider directory under a key of tf/azure/.terraform.lock.hcl and SHALL give that directory to the gate step as TF_PLUGIN_CACHE_DIR.
Scenario: The edited workflow passes its validators
- WHEN
uv run devops ci --check --only actionlint,zizmorruns - THEN both rows pass
Requirement: The change records the row in the gate spec
The change SHALL add the tofu row's requirement to the ci-gate-rows specification.
Scenario: The OpenSpec check passes
- WHEN
uv run devops ci --check --only openspecruns - THEN the row passes with the change's spec delta on
ci-gate-rows
Existing Tool Considered
No alternatives check has run. OpenTofu CLI 1.13.9 (MPL-2.0) is the open, maintained tool that covers the need. It is already in the devcontainer at .devcontainer/Dockerfile:206, and the static job installs it at .github/workflows/ci.yml:80. It runs tofu init -backend=false and tofu validate with no Azure credential. It lacks a check against a real subscription: tofu plan needs a test subscription and credentials that a person provides, so that part stays out of scope. The project's devops tf init lacks a -backend=false option and a lock-file guard, so the gate row uses a tests/gate module.
Key questions
- Which gate runs the
tofucheck?: Add atofurow toCHECK_ROW_NAMESand the check registry. The existingStatic Analysisjob runs every row and already installs OpenTofu. The row command uses_python_check_cmd('tofu_validate'). (best practice) [sources: src/devops_cli/commands/ci.py:135, src/devops_cli/commands/ci.py:931, .github/workflows/ci.yml:80, openspec/specs/ci-gate-rows/spec.md]- Chosen: New
devops cirow. The gate dispatches rows from one registry, and the static job already runs every row and installs OpenTofu. - Rejected: New workflow step. It splits the check from the local gate, repeats the OpenTofu setup, and leaves
devops ciunable to run the check.
- Chosen: New
- How does one row run two commands in
tf/azure?: Use atests/gate/tofu_validate.pymodule that the row starts with_python_check_cmd('tofu_validate'). The module owns the working directory, runstofu init -backend=falseand thentofu validateintf/azure, and passesTF_PLUGIN_CACHE_DIRto both commands. (best practice) [sources: src/devops_cli/commands/ci.py:205, src/devops_cli/commands/ci.py:931, src/devops_cli/config/constants.py:2605, openspec/specs/ci-gate-rows/spec.md]- Chosen: A
tests/gatemodule. It fits the row pattern, owns the working directory and the environment, and needs no product command change. - Rejected: Two
devops tfcommands viaalso_cmds.devops tf inithas no-backend=falseoption and no lock-file guard, andalso_cmdsrun in the repository root, not intf/azure. - Rejected: Extend
devops tf initanddevops tf validate. It grows the product CLI, its docs and the MCP tool snapshots for a CI-only need.
- Chosen: A
- How does the row enforce a committed provider lock file?: The module hashes
tf/azure/.terraform.lock.hclbeforetofu init -backend=falseand after. It fails with a finding that names the path when the file is absent or its bytes change. A valid committed lock file is left untouched by init. (best practice) [sources: tf/azure/versions.tf, src/devops_cli/commands/tf.py]- Chosen: Compare the lock file before and after init. It uses the file the project already names as the lock file, and it fails on a missing, stale or platform-incomplete file.
- Rejected:
tofu init -lockfile=readonly. No source in this repository or the issue documents that flag, so the row must not depend on it. - Rejected:
git diffafter init. It couples the row to git state, and an unrelated worktree change makes the result unclear.
- Does
tofu validateneed Azure credentials?: No. The project classesdevops tf validateasno-external-request: it runstofu validatein the directory, and the provider schema check makes no Azure API call.-backend=falsekeeps init from reading a backend configuration. TheStatic Analysisjob sets no Azure credential. [sources: src/devops_cli/commands/tf.py] - Which provider platforms does the lock file need?:
linux_amd64, the platform of theubuntu-26.04runner. The gate runs on that runner only. Anarm64devcontainer can add its own checksums later if a local run shows a dirty lock file. (best practice) [sources: .github/workflows/ci.yml:51, tf/azure/versions.tf]- Chosen: Runner platform only. The gate runs on
linux_amd64, so the committed lock file covers the check. - Rejected: Runner and devcontainer platforms. It adds arm64 checksums that no CI check runs and no acceptance criterion proves.
- Rejected: Every developer platform. It adds checksums for platforms that neither the gate nor the devcontainer runs.
- Chosen: Runner platform only. The gate runs on
- How does the static job stay under its time limit?: The row sets
timeout_seconds=120, under the static job's 6-minute timeout. The static job also caches the OpenTofu provider directory withactions/cacheat the pinned digest, keyed ontf/azure/.terraform.lock.hcl, and gives that directory to the gate step asTF_PLUGIN_CACHE_DIR. (best practice) [sources: .github/workflows/ci.yml:51, .github/workflows/ci.yml:80, .github/actions/setup-toolchain/action.yml:53, src/devops_cli/commands/ci.py:205, src/devops_cli/ai/knowledge_base/devops_cli/tasks/infrastructure_provisioning.md]- Chosen: Row bound plus provider cache. The bound fails a hung run before the job limit, and the cache keeps the provider download out of the critical path.
- Rejected: No cache. The provider download repeats on every run of a job that has 6 minutes for all rows.
- Rejected: No row bound. A hung download then fails as a job timeout that names no row.
- Rejected: Separate job. It repeats checkout, the toolchain and the OpenTofu setup, and the job limit is the 6 minutes the issue already constrains.
- What does this issue wait on?: build(terraform): move the azurerm provider to 5.x #5074 moves
tf/azureto azurerm~> 5.13and keeps the pin. This issue commits the lock file after that.tf/azure/versions.tfstill holdsversion = "~> 3.100"at this commit. [sources: tf/azure/versions.tf]
Fit
Fits in one pull request.
Suspected block
None.
Activity
devops-cli-service commentedon Nov 16, 2026
Both split from #5074; #5074 moves the azurerm provider pin and edits, while the candidate adds the CI validation check that guards that pin.devops-cli-service commentedon Nov 18, 2026
Refine cannot set this item to Ready at 4ddf77e while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
The next refine round also looks at the item again when a commit on the default branch changes one of these files:
tf/azure/versions.tf.devops-cli-service commentedon Nov 22, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
dan-petty commentedon Nov 26, 2026
Closed:
tf/moved to dan-petty/infra, and the check exists there.The OpenTofu job of the infra CI runs
tofu init -backend=falseandtofu validatein each folder oftf/examples/, with committed lock files. This repository holds notf/code to validate.