add support for linting IaC#48
Conversation
Signed-off-by: ms280690 <mehul@sparkgeo.com>
|
🤖 Hi @ms280690, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
Pull request overview
Adds first-class Infrastructure-as-Code linting support to this repo by introducing a pinned, checksum-verified TFLint composite action and a reusable Lint IaC workflow intended for Terraform/OpenTofu repos, plus documentation and a CI smoke-test to dogfood it.
Changes:
- Add a reusable workflow (
lint-iac.yml) that runs TFLint recursively with plugin caching and PR annotations. - Add a composite action (
.github/actions/tflint) that installs and runs a checksum-verified TFLint binary with a problem matcher. - Update docs/README and approved-actions allowlist docs; add an IaC-focused pre-commit example config and CI smoke test.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new Lint IaC reusable workflow and TFLint composite action usage. |
| examples/iac.pre-commit-config.yaml | Provides a reference pre-commit configuration for Terraform/OpenTofu repos. |
| docs/approved-actions.md | Adds tflint to the approved actions/binaries list with version and verification notes. |
| .github/workflows/lint-iac.yml | Introduces the reusable IaC lint workflow (checkout, cache, run TFLint composite). |
| .github/workflows/ci.yml | Adds a CI smoke-test job to verify the TFLint composite installs and runs. |
| .github/actions/tflint/tflint-matcher.json | Defines a problem matcher for TFLint compact output to produce PR annotations. |
| .github/actions/tflint/action.yml | Implements the TFLint composite action (download+checksum verify, init, lint). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: ms280690 <mehul@sparkgeo.com>
michaelconnor00
left a comment
There was a problem hiding this comment.
It looks good. Some questions though:
- How is this going to interact with terramate?
- Will it work with OpenTofu? I am guess there will be no issue until they diverge...
|
Also, please create better PR descriptions. Not even a link to the issue? I have a claude skill for this if you like. |
…enerated-file linting tflint reads only .tf (not .tofu) and does not understand OpenTofu-only syntax like the encryption block. tflint --recursive also lints committed terramate-generated .tf files, which trip rules the team can't hand-fix; the default error severity floor keeps these Warning-level findings non-blocking. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Closes #9. Infrastructure-as-Code lint stage of parent #12. Reuses the shared
lint-precommit.ymlfrom #10; adds the tflint PR gate.What
.github/actions/tflint/action.yml--init(plugins) then--recursive --format compact --minimum-failure-severity..github/actions/tflint/tflint-matcher.json.github/workflows/lint-iac.ymldirectory,minimum-failure-severity,actions-ref. Caches tflint plugins viaactions/cache..github/workflows/ci.ymltflintjob (smoke test — no.tfin this repo).examples/iac.pre-commit-config.yamlterraform_fmt/terraform_validate/terraform_tflint.README.md,docs/approved-actions.md.tflint.hcl), tooling tracking.Acceptance criteria (#9)
lint-iac.yml: installs tflint with plugin support;tflint --recursivefromdirectory; PR annotations; blocks on error-level findingsdirectoryinput (non-root IaC dirs)minimum-failure-severityinput (defaulterror)actions/cache, keyed on any.tflint.hcl).tflint.hcl.tflint.hclfor AWS, GCP, AzureDesign notes
setup-tflint— one verified download, no new org-allowlist publisher, zizmor-clean (noGITHUB_PATHwrite). Consistent with the gitleaks/trufflehog/megalinter pattern.harden-runner(caller context / private-repo telemetry) and uses the immutableactions-refself-reference pattern.hashFiles('**/.tflint.hcl')— invalidates on any config change regardless ofdirectory.Verified
tflint.zipvs the checksum'stflint_linux_amd64.zip).--minimum-failure-severity errorpasses on warning-only findings.Not included
.tfdogfood — none in this repo; the CI job is an install smoke test.🤖 Generated with Claude Code