fix(pre-commit): unbreak tflint, free disk in terraform_validate, scope trivy#107
Open
camrschuette wants to merge 3 commits into
Open
fix(pre-commit): unbreak tflint, free disk in terraform_validate, scope trivy#107camrschuette wants to merge 3 commits into
camrschuette wants to merge 3 commits into
Conversation
terraform_validate runs `terraform init` in every module directory, each pulling its own copy of the provider plugins (~700 MB for aws alone). Repos with many modules exhaust the runner's ~14 GB disk with "no space left on device". Reclaim ~15-25 GB by removing preinstalled toolchains (android SDK, dotnet, haskell, swift) this job never uses. No behavior change for other jobs or small repos. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Defaults to '.' (unchanged behavior). Callers can pass a narrower path (e.g. 'terraform') to limit the fs scan to IaC and skip app dependency CVE / Dockerfile findings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GitHub REST API 2026-03-10 removed the `bundle` field from attestation list responses. tflint's default `auto` signature mode prefers attestations, unmarshals the now-null bundle into a nil *bundle.Bundle without erroring, and panics dereferencing it inside sigstore verify. `tflint --init` crashes before any linting runs, failing the terraform_tflint hook in every consuming repo. Pinning the plugin to `signature = "pgp"` takes the legacy verification path instead. Verification stays enabled; tflint emits a deprecation warning about the legacy signing key. Pinning an older tflint does not help — the trigger is server-side and every version taking the attestation path panics. Upstream: terraform-linters/tflint#2591 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fixes to the shared
pre-commit.yml. The tflint one is an active outage — every repo consuming this workflow is currently failingterraform_tflint. The other two have been running in stratusphere via a branch pin since 2026-07-08; this merge retires that pin.1.
fix(tflint)— unbreakterraform_tflinteverywhere (urgent)Not a lint failure:
tflint --initpanics installing the aws plugin, before any linting runs.Server-side cause, nothing in our repos changed. GitHub REST API 2026-03-10 removed the
bundlefield from attestation list responses. tflint calls that endpoint to verify the plugin, and:"bundle": nullnullinto a**Bundle— sets the pointer nil and returns no error, so its own nil guard atplugin/signature.go:133never firesverifier.Verify(b, policy)calls a method on the nil receiver; sigstore-go`s nil check dereferences it. Panic.A latent tflint bug that only fires once the server returns null. Upstream terraform-linters/tflint#2591 — filed 2026-07-16, still open,
masterunpatched.signature = "pgp"takes the legacy PGP verification path instead of the defaultauto(which prefers attestations). Verification stays enabled. tflint emits a deprecation warning about the legacy key; the hook passes.v0.40.0shipschecksums.txt.sig, so the PGP path is valid for the pinned version.Alternatives ruled out:
signature = "none"— works but disables verification. Avoided; PGP works.Verified by reproducing the exact CI panic locally, then confirming the fix against a clean plugin dir on tflint v0.63.1 with an authenticated
GITHUB_TOKEN:Confirmed green in stratusphere CI:
Terraform validate with tflint...Passed.2.
fix(terraform_validate)— free disk before per-module initterraform_validaterunsterraform initin every module directory, each downloading its own provider copies (aws provider alone is ~700 MB unpacked). Repos with many modules exhaust the runners ~14 GB disk withno space left on device`. Removes preinstalled toolchains the job never uses (android, dotnet, ghc, swift). Purely additive — a no-op for small repos.3.
feat(pre-commit)—trivy_scan_refinputAdds an optional input to scope the
terraform_trivyfs scan. Defaults to".", so existing callers are unaffected. Callers can pass a narrower path (e.g.terraform) to limit the scan to IaC and skip app dependency CVE / Dockerfile findings handled elsewhere.Notes for reviewers
Checkout precommit configstep has noref:, so config is always read from this repos default branch — pinning the reusable workflow to a feature branch does not change which config CI uses. That is why the tflint fix has to land onmain` to take effect anywhere.@fix/tf-validate-free-disk→@main) and deletes its stopgap local.tflint.hcl.--onlyrule in the tflint hook is a bundledterraform_*rule — no aws-ruleset rule is enabled. The aws plugin install is dead weight and the sole reason this failure mode can hit us. Dropping it would remove the class entirely.🤖 Generated with Claude Code