A Pluggable Terraform Linter

★ 5,858⑂ 423👁 36⑃ 1,872● 606▤ 137
GoMPL-2.0Created 2016-10-20
下载:v0.66.0v0.66.0 ↓0.66.02026-11-08
+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

Discussions

Latest release

v0.66.0 v0.66.0 2026-11-08
What'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

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON