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: 9 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 (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-04-07T11:10:00.000Z (13 days ago)
- Last Synced: 2025-04-09T15:56:22.779Z (10 days 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.**
Dockerized as [devopsinfra/action-tflint](https://hub.docker.com/repository/docker/devopsinfra/action-tflint).
Uses the newest version of Terraform and TFLint for the current release.
So it's main use will be everywhere where [Terraform](https://github.com/hashicorp/terraform) is used and is great for statically or actively checking modules' sources.
Main action is using [wata727](https://github.com/wata727)'s [TFLint](https://github.com/terraform-linters/tflint).
## Badge swag
[](https://github.com/devops-infra/action-tflint/actions?query=workflow%3A%22Master+branch%22)
[](https://github.com/devops-infra/action-tflint/actions?query=workflow%3A%22Other+branches%22)
[




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




](https://hub.docker.com/r/devopsinfra/action-tflint "shields.io")## Reference
```yaml
- name: Run the Action
uses: devops-infra/[email protected]
with:
dir_filter: modules
```| 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. |## Examples
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@v2
- name: Check linting of Terraform files
uses: devops-infra/[email protected]
```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@v2
- name: Check linting of Terraform modules
uses: devops-infra/[email protected]
with:
tflint_config: modules/.tflint.hcl
dir_filter: modules/aws,modules/gcp
```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@v2
- name: Check linting of Terraform modules
uses: devops-infra/[email protected]
with:
tflint_params: "--module --deep"
dir_filter: modules
```