File tree Expand file tree Collapse file tree 2 files changed +73
-41
lines changed
Expand file tree Collapse file tree 2 files changed +73
-41
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : Validate and lint
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - main
7+
8+ jobs :
9+ terraform_validation :
10+ strategy :
11+ matrix :
12+ version : ["1.11", latest]
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v4
18+
19+ - name : Set up Terraform
20+ uses : hashicorp/setup-terraform@v3
21+ with :
22+ terraform_version : ${{ matrix.version }}
23+
24+ - name : Print tf version
25+ run : terraform version
26+
27+ - name : Terraform init
28+ run : " terraform init || terraform init -upgrade"
29+
30+ - name : Terraform validate
31+ run : " terraform validate"
32+
33+ - name : Terraform fmt
34+ run : |
35+ terraform fmt
36+ if [ -n "$(git status --porcelain)" ]; then
37+ echo "ERROR: terraform fmt resulted in changes. Run 'terraform fmt' locally and append the changes."
38+ echo
39+ git diff
40+ echo
41+ git status
42+ exit 1
43+ fi
44+
45+ tflint :
46+ runs-on : ubuntu-latest
47+
48+ steps :
49+ - uses : actions/checkout@v3
50+ name : Checkout source code
51+
52+ - uses : actions/cache@v3
53+ name : Cache plugin dir
54+ with :
55+ path : ~/.tflint.d/plugins
56+ key : tflint-${{ hashFiles('.tflint.hcl') }}
57+
58+ - uses : terraform-linters/setup-tflint@v1
59+ name : Setup TFLint
60+ with :
61+ tflint_version : v0.60.0
62+
63+ - name : Show version
64+ run : tflint --version
65+
66+ - name : Init TFLint
67+ run : tflint --init
68+ env :
69+ # https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
70+ GITHUB_TOKEN : ${{ github.token }}
71+
72+ - name : Run TFLint
73+ run : tflint -f compact
You can’t perform that action at this time.
0 commit comments