Skip to content

Commit

Permalink
add terraform linter (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolte authored May 20, 2023
1 parent 3a8f659 commit 5f0379e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/reuseable-tf-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: tf-lint

on:
workflow_call:
secrets:
token:
required: true

permissions:
contents: write
pull-requests: write

jobs:
tflint:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

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

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

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

- name: Show version
run: tflint --version

- name: Init TFLint
run: tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ secrets.token }}

- name: Run TFLint
run: tflint -f compact
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Used for deduplicate the CI/CD Boilerplate-Code. Like [Workflow](https://docs.gi
| ```reuseable-sphinx.yaml``` | Build and Publish a [Sphinx](https://www.sphinx-doc.org/en/master) Documentation as [Github Page](https://pages.github.com/). |
| ```reuseable-stale.yaml``` | Mark old or inactive issues and close then, used [actions/stale](https://github.com/actions/stale) for this work. |
| ```reuseable-trivy.yaml``` | Scan the GitRepo by using [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action). |
| ```reuseable-tf-lint.yaml``` | Use [terraform-linters/setup-tflint](https://github.com/terraform-linters/setup-tflint) for Lint terraform sources. |
<!--td-workflows-end-->

## Probot Config
Expand Down

0 comments on commit 5f0379e

Please sign in to comment.