Skip to content

Commit

Permalink
add tflint workflow for all terraform directories
Browse files Browse the repository at this point in the history
  • Loading branch information
alismx committed Nov 20, 2024
1 parent 52d4677 commit 46bdf15
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/tflint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Terraform Linting
on:
pull_request:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tflint:
runs-on: ubuntu-latest

strategy:
matrix:
dirs: [terraform/modules/oidc, terraform/modules/tfstate, terraform/implementation/setup, terraform/implementation/ecs]

steps:
- uses: actions/checkout@v4
name: Checkout source code

- uses: actions/cache@v4
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ${{ matrix.dirs }}-tflint-${{ hashFiles('.tflint.hcl') }}

- uses: terraform-linters/setup-tflint@v4
name: Setup TFLint
with:
tflint_version: v0.52.0

- name: Show version
run: tflint --version

- name: Init TFLint
run: tflint --init
# If rate limiting becomes an issue, setup a GitHub token and enable it as an environment variable
# env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
# GITHUB_TOKEN: ${{ github.token }}

- name: Run TFLint
working-directory: ${{ github.workspace }}/${{matrix.dirs}}
run: tflint -f compact

0 comments on commit 46bdf15

Please sign in to comment.