Update pre-commit for tflint use, and make it happy #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform validation | |
on: | |
push: | |
branches: [ master, develop ] | |
pull_request: | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: hashicorp/setup-terraform@v2 | |
- name: Terraform fmt | |
id: fmt | |
run: terraform fmt -check | |
continue-on-error: true | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
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 | |
- 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: ${{ github.token }} | |
- name: Run TFLint | |
run: tflint -f compact |