-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (56 loc) · 1.72 KB
/
terraform-lint-format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Terraform fmt and linter
on:
workflow_call:
inputs:
terraform_version:
description: "Version of terraform binary"
type: string
default: "1.9.8"
enable_tflint:
description: "Enable Tflint"
type: boolean
default: true
tflint_severity_threshold:
description: "Threshold of minimum failure severity for tflint. Examples - error | warning | notice"
type: string
default: warning
tflint_version:
description: "TFLint version"
type: string
default: v0.53.0
jobs:
terraform-fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setting up terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "${{ inputs.terraform_version }}"
- name: "Running format"
run: terraform fmt --recursive --diff -check=true
terraform-tflint:
if: ${{ inputs.enable_tflint }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache plugin dir
uses: actions/cache@v4
with:
path: ~/.tflint.d/plugins
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v3
with:
tflint_version: ${{ inputs.tflint_version }}
- name: Init TFLint
run: tflint --init
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Run TFLint
run: tflint --minimum-failure-severity=${{ inputs.tflint_severity_threshold }} -f compact