https://github.com/devops-infra/action-tflint
GitHub Action that will run TFlint on Terraform files.
https://github.com/devops-infra/action-tflint
action-tflint automation christophshyper ci-cd cicd devops devops-workflow docker dockerhub github-action github-action-docker github-actions github-actions-docker iaac linter terraform terraform-modules terraform-scripts tflint
Last synced: 13 days ago
JSON representation
GitHub Action that will run TFlint on Terraform files.
- Host: GitHub
- URL: https://github.com/devops-infra/action-tflint
- Owner: devops-infra
- License: mit
- Created: 2020-04-03T21:51:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-07T11:10:00.000Z (12 months ago)
- Last Synced: 2025-04-09T15:56:22.779Z (12 months ago)
- Topics: action-tflint, automation, christophshyper, ci-cd, cicd, devops, devops-workflow, docker, dockerhub, github-action, github-action-docker, github-actions, github-actions-docker, iaac, linter, terraform, terraform-modules, terraform-scripts, tflint
- Language: Dockerfile
- Homepage: https://christophshyper.github.io/
- Size: 158 KB
- Stars: 16
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
- jimsghstars - devops-infra/action-tflint - GitHub Action that will run TFlint on Terraform files. (Dockerfile)
README
# 🚀 GitHub Action linting Terraform files
**GitHub Action that will run TFlint on Terraform files.**
## 📦 Available on
- **Docker Hub:** [devopsinfra/action-tflint:latest](https://hub.docker.com/repository/docker/devopsinfra/action-tflint)
- **GitHub Packages:** [ghcr.io/devops-infra/action-tflint:latest](https://github.com/orgs/devops-infra/packages/container/package/action-tflint)
## ✨ Features
- Main use will be everywhere where [Terraform](https://github.com/hashicorp/terraform) is used and is great for statically or actively checking modules' sources.
- Using [wata727](https://github.com/wata727)'s [TFLint](https://github.com/terraform-linters/tflint).
## 📊 Badges
[




](https://github.com/devops-infra/action-tflint "shields.io")
[




](https://hub.docker.com/r/devopsinfra/action-tflint "shields.io")
## 🏷️ Version Tags: vX, vX.Y, vX.Y.Z
This action supports three tag levels for flexible versioning:
- `vX`: latest patch of the major version (e.g., `v1`).
- `vX.Y`: latest patch of the minor version (e.g., `v1.2`).
- `vX.Y.Z`: fixed to a specific release (e.g., `v1.2.3`).
## 📖 API Reference
```yaml
- name: Run the Action
uses: devops-infra/action-tflint@v1.0.0
with:
dir_filter: modules
```
### 🔧 Input Parameters
| Input Variable | Required | Default | Description |
|-------------------|----------|---------------|------------------------------------------------------------------------------------------------------------|
| `dir_filter` | No | `*` | Prefixes or sub-directories to search for Terraform modules. Use comma as separator. |
| `fail_on_changes` | No | `true` | Whether TFLint should fail whole action. |
| `tflint_config` | No | `.tflint.hcl` | Location from repository root to TFLint config file. Disables `tflint_params`. |
| `tflint_params` | No | `` | Parameters passed to TFLint binary. See [TFLint](https://github.com/terraform-linters/tflint) for details. |
| `run_init` | No | `true` | Whether the action should run `terraform init`. Defaults to true. |
## 💻 Usage Examples
### 📝 Basic Example
By default fail if lint errors found in any subdirectory. Run the Action via GitHub.
```yaml
name: Check TFLint
on:
push:
branches:
- "**"
jobs:
format-hcl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Check linting of Terraform files
uses: devops-infra/action-tflint@v1.0.0
```
### 🔀 Advanced Example
Use different location for TFLint config file and parse only `aws*` and `gcp*` modules in `modules/` directory. Run the Action via GitHub.
```yaml
name: Check TFLint with custom config
on:
push:
branches:
- "**"
jobs:
format-hcl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Check linting of Terraform modules
uses: devops-infra/action-tflint@v1.0.0
with:
tflint_config: modules/.tflint.hcl
dir_filter: modules/aws,modules/gcp
```
### 🔀 Advanced Example
Use deep check (need cloud credentials) and treat all directories under `modules` as Terraform modules. Run the Action via DockerHub.
```yaml
name: Check TFLint with custom config
on:
push:
branches:
- "**"
jobs:
format-hcl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Check linting of Terraform modules
uses: devops-infra/action-tflint@v1.0.0
with:
tflint_params: "--module --deep"
dir_filter: modules
```
## 🤝 Contributing
Contributions are welcome! See [CONTRIBUTING](https://github.com/devops-infra/.github/blob/master/CONTRIBUTING.md).
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 💬 Support
If you have any questions or need help, please:
- 📝 Create an [issue](https://github.com/devops-infra/action-tflint/issues)
- 🌟 Star this repository if you find it useful!