ADR-0036: One lockfile for the CI tools, installed by one script#
- Status: accepted. Changes how ADR-0015 installs OpenTofu in CI.
- Date: 2026-11-27
Context#
CI downloads five tools and TFLint's AWS ruleset. Each tool was pinned where it was installed: OpenTofu in the setup-tofu action through opentofu/setup-opentofu, TFLint through terraform-linters/setup-tflint, and Trivy, gitleaks and terraform-docs in their own curl steps in terraform-plan, each with a version and a checksum. gitleaks was pinned again in the pre-commit configuration, and the ruleset in .tflint.hcl, from where tflint --init fetched it through the GitHub API with the job's token.
So a bump was an edit in a different place for each tool, two of the tools came through third-party Actions, and nothing installed the same versions locally: make check needed all five installed by hand.
Decision#
tools.lock, a plain-text file at the root, is the one place a CI tool is pinned: for each, its version, the URL of its Linux amd64 release archive, that archive's SHA-256 and the file to take from it. The ruleset is in it too, with the plugin path TFLint looks for.scripts/install-tools.py, standard library only, installs from it, for CI and formake tools. It refuses an archive whose SHA-256 differs, before extracting anything, and is idempotent.- The ruleset's signature is still checked on every install, without the API: its release's checksums file must verify, with gpg, against the PGP key built into the pinned TFLint binary, whose fingerprint
tools.lockpins, and must list the pinned SHA-256. The artifact attestation thattflint --initchecks through the API is checked when a version is pinned. - CI installs every tool through the script, replacing
setup-opentofu,setup-tflintand the threecurlsteps, and the lint job no longer gives TFLint a token. make pinschecks the lockfile and the copies it cannot remove: every tool has a numeric version and a 64-character checksum, no workflow pins one of its tools again, and the pre-commit hook's gitleaks version and.tflint.hcl's ruleset version equal the lockfile's.
Alternatives considered#
A tool version manager such as aqua or mise. It does this job and more platforms, and would be one more binary to pin and trust, with its own registry of where each tool comes from. On Hold on the radar.
Keep tflint --init fetching the ruleset in CI, for its attestation check on every run. It needs the GitHub API and a token in the lint job, and with the archive's checksum pinned it proves on every run what was proved once, when the checksum was pinned.
One lockfile entry per platform. Would make make tools work on macOS and arm64, at the cost of four checksums per tool that CI never exercises.
Ruff in CI through the same file. Ruff lints the Python only in pre-commit, and the code it would check is not yet clean under it, so adding it is a separate change.
Consequences#
Positive: a bump is one edit, two lines in one file, and a full local make check is make tools check. Two third-party Actions leave CI, and so does the lint job's use of its token. The check that the pre-commit hook matches CI is now a machine's, not a comment's.
Negative: a script of about 300 lines and its tests to maintain. The ruleset's per-install signature check uses a PGP key that has expired and that TFLint calls legacy. make tools needs gpg, and works on Linux amd64 only.
Neutral: the same versions and checksums as before. The CI tools still need a person to supply each checksum, and Renovate still proposes versions.
Revisit when#
- A ruleset release stops publishing a PGP signature, or TFLint drops its key: the install then fails, and the per-install check needs another source.
- The tools are wanted on platforms other than Linux amd64.
- The radar's condition for a version manager is met.