+0
日增长
5,858
stars
423
forks
36
watchers
1,872
prs
606
issues
137
releases
README
TFLint
A Pluggable Terraform Linter
Features
TFLint is a framework and each feature is provided by plugins, the key features are as follows:
- Find possible errors (like invalid instance types) for Major Cloud providers (AWS/Azure/GCP).
- Warn about deprecated syntax, unused declarations.
- Enforce best practices, naming conventions.
Installation
Download the appropriate archive from the latest release, verify it, and install the binary:
console
curl -sSLO https://github.com/terraform-linters/tflint/releases/latest/download/tflint_linux_amd64.zip
curl -sSLO https://github.com/terraform-linters/tflint/releases/latest/download/checksums.txt
gh attestation verify checksums.txt -R terraform-linters/tflint
sha256sum --ignore-missing -c checksums.txt
unzip tflint_linux_amd64.zip
sudo install -c -v tflint /usr/local/bin/
Homebrew (macOS):
console
brew install --cask terraform-linters/tap/tflint
WinGet (Windows):
console
winget install -e --id TerraformLinters.tflint
Go:
console
go install github.com/terraform-linters/tflint@latest
Verification
GitHub CLI (Recommended)
Artifact Attestations are available that can be verified using the GitHub CLI.
console
gh attestation verify checksums.txt -R terraform-linters/tflint
sha256sum --ignore-missing -c checksums.txt
Cosign (Deprecated)
[!WARNING]
Cosign signatures are now deprecated. Please use GitHub CLI.
Cosign verify-blob command ensures that the release was built with GitHub Actions in this repository.
console
cosign verify-blob --certificate=checksums.txt.pem --signature=checksums.txt.keyless.sig --certificate-identity-regexp="^https://github.com/terraform-linters/tflint" --certificate-oidc-issuer=https://token.actions.githubusercontent.com checksums.txt
sha256sum --ignore-missing -c checksums.txt
Docker
Instead of installing directly, you can use the Docker image:
console
docker run --rm -v $(pwd):/data -t ghcr.io/terraform-linters/tflint
To download plugins, you can override the entrypoint to a shell (sh) to run --init and the main command in a single docker run command:
console
docker run --rm -v $(pwd):/data -t --entrypoint /bin/sh ghcr.io/terraform-linters/tflint -c "tflint --init && tflint"
GitHub Actions
If you want to run on GitHub Actions, setup-tflint action is available.
Getting Started
First, enable rules for Terraform Language (e.g. warn about deprecated syntax, unused declarations). TFLint Ruleset for Terraform Language is bundled with TFLint, so you can use it without installing it separately.
The bundled plugin enables the "recommended" preset by default, but you can disable the plugin or use a different preset. Declare the plugin block in .tflint.hcl like this:
hcl
plugin "terraform" {
enabled = true
preset = "recommended"
}
See the tflint-ruleset-terraform documentation for more information.
Next, If you are using an AWS/Azure/GCP provider, it is a good idea to install the plugin and try it according to each usage:
- Amazon Top issues
#1181Allow version constraints in plugin `version`13 comments · 2021-08-12#1202Feature: allow plugin sources other than GitHub9 comments · 2021-08-31#1929Configurable recursive inspection7 comments · 2023-12-02#1849Provide Summary after tflint Command Run6 comments · 2023-09-18#1536Git config like .tflint.hcl files combination5 comments · 2022-10-05#2448Support ed25519 keys for plugin signing3 comments · 2026-01-20#2435Improve handling of root-only traversal expressions3 comments · 2025-12-16#2128Linting tftest.hcl files3 comments · 2024-09-20
Discussions
#2663Can we configure tflint plugins (terraform lint /Google or AWS) to download using Artifacatory ?1 comments · 2026-10-14#2625Add linux_riscv64 release target1 comments · 2026-08-10#2615Add a .tflintigore or config option to ignore files1 comments · 2026-07-20#2545Failed to check ruleset; timeout waiting for connection info3 comments · 2026-05-27#2543Support a `.tflint-version` file similar to `.terraform-version`.0 comments · 2026-05-27#2528Removed from homebrew-core1 comments · 2026-05-13#2494Immutable Releases2 comments · 2026-04-01#2487CI: Add WinGet publishing step2 comments · 2026-03-17
Latest release
v0.66.0 v0.66.0 2026-11-08What's Changed Enhancements Add support for Terraform v1.17 by @wata727 in https://github.com/terraform-linters/tflint/pull/2687 Bug Fixes formatter: omit helpUri in SARIF output when a rule has no link by @lbarrosby in https://github.com/terraform-linters/tflint/pull/2688 Chores build(deps): Bump golang from 1.26.10-alpine3.23 to 1.27.2-alpine3.23 by @dependabot[bot] in https://github.com/terraform-linters/tflint/pull/2675 build(deps): Bump golang.org/x/net from 0.60.0 to 0.61.0 in the go-x group by @dependabot[bot] in https://github.com/terraform-linters/tflint/pull/2676 build(dep