Skip to content

Commit 27a96c4

Browse files
separate tflint
1 parent b97a34a commit 27a96c4

File tree

1 file changed

+32
-23
lines changed

1 file changed

+32
-23
lines changed

.github/workflows/terraform.yml

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,38 @@ jobs:
5555
with:
5656
sarif_file: terrascan.sarif
5757

58+
tflint:
59+
runs-on: ubuntu-latest
60+
name: "TFlint"
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- uses: actions/cache@v4
66+
name: Cache plugin dir
67+
with:
68+
path: ~/.tflint.d/plugins
69+
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
70+
71+
- uses: terraform-linters/setup-tflint@v4
72+
name: Setup TFLint
73+
with:
74+
tflint_version: v0.52.0
75+
76+
- name: Show version
77+
run: tflint --version
78+
79+
- name: Init TFLint
80+
run: tflint --init
81+
env:
82+
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
83+
GITHUB_TOKEN: ${{ github.token }}
84+
85+
- name: Run TFLint
86+
run: tflint -f compact --recursive --minimum-failure-severity=error
87+
5888
terraform:
59-
name: "Terraform CICD"
89+
name: "Terraform"
6090
runs-on: ubuntu-latest
6191
permissions:
6292
pull-requests: write # Required for creating or updating PRs
@@ -116,28 +146,6 @@ jobs:
116146
id: validate
117147
run: terraform validate
118148

119-
- uses: actions/cache@v4
120-
name: Cache plugin dir
121-
with:
122-
path: ~/.tflint.d/plugins
123-
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
124-
125-
- uses: terraform-linters/setup-tflint@v4
126-
name: Setup TFLint
127-
with:
128-
tflint_version: v0.52.0
129-
- name: Show version
130-
run: tflint --version
131-
132-
- name: Init TFLint
133-
run: tflint --init
134-
env:
135-
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
136-
GITHUB_TOKEN: ${{ github.token }}
137-
138-
- name: Run TFLint
139-
run: tflint -f compact --recursive --minimum-failure-severity=error
140-
141149
- name: Terraform plan [pull_request]
142150
id: plan-pr
143151
if: github.event_name == 'pull_request'
@@ -213,6 +221,7 @@ jobs:
213221
echo "unsupported environment";
214222
fi
215223
terraform apply -var-file=variables/$ENV.auto.tfvars -auto-approve -lock=false
224+
216225
otel-cicd-action:
217226
if: always()
218227
name: OpenTelemetry Export Trace

0 commit comments

Comments
 (0)