feat: add reusable Terraform lint workflow (tf-lint.yml) - #50
Merged
Conversation
Implements the shared tf-lint.yml workflow requested in #41. Runs four quality gates over a caller-specified Terraform directory: terraform fmt -check -recursive, terraform init -backend=false + terraform validate (no credentials needed — deliberate for fork PRs), tflint, and trivy config for IaC misconfiguration scanning. Each gate is individually toggleable. Trivy is used over checkov for fleet consistency with the existing container scan in site-deploy.yml. Ships at v1.2.0. Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
Closes #41.
Adds
tf-lint.yml, a reusableworkflow_callworkflow that gives the five fleet repos carrying Terraform (solidago,kalmia,claytonia,drosera,.github) a consistent, centrally-maintained lint gate rather than ad-hoc per-repo scripts.Four quality gates, each independently toggleable:
terraform fmt -check -recursive— formatting consistencyterraform init -backend=false+terraform validate— config validity; the-backend=falseflag is deliberate: no remote state means no cloud credentials, so this gate is safe to run on fork PRs without secretstflint— idiomatic Terraform and provider-specific rulestrivy config— IaC misconfiguration scan; Trivy is chosen over Checkov for fleet consistency (it already runs insite-deploy.ymlfor container scanning — one tool across two surfaces, not two separate tools)Design choices:
uses:lineif: github.event.pull_request.draft == falsegate consistent withshellcheck.ymlpaths:-filter rule — same language asdocs-check.yml@v1.2.0(v1.1.0 is already cut); adoption by each Terraform repo is per-repo and stagedFiles changed:
.github/workflows/tf-lint.yml— new reusable workflowREADME.md—tf-lint.ymlsection with caller example and full input tableCLAUDE.md— workflow inventory table updated🤖 Generated with Claude Code