Skip to content

Commit 5659388

Browse files
committed
ci: refactor terraform validation
1 parent 2a51949 commit 5659388

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

.github/workflows/terraform-validate-template.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,29 @@ jobs:
4949
- name: Initialize Terraform
5050
run: terraform init -get -backend=false -input=false
5151
- name: Check Terraform formatting
52-
run: terraform fmt -check=true -write=false
52+
run: terraform fmt -recursive -check=true -write=false
53+
- name: Reviewdog suggester (Terraform fmt)
54+
uses: reviewdog/action-suggester@v1
55+
with:
56+
tool_name: "terraform fmt -recursive"
5357
- name: Validate Terraform
5458
run: terraform validate
5559
- uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
5660
name: Cache TFLint plugin dir
5761
with:
5862
path: ~/.tflint.d/plugins
5963
key: tflint-${{ hashFiles('.tflint.hcl') }}
60-
- name: Setup TFLint
61-
uses: terraform-linters/setup-tflint@19a52fbac37dacb22a09518e4ef6ee234f2d4987 # v4.0.0
64+
# - name: Setup TFLint
65+
# uses: terraform-linters/setup-tflint@19a52fbac37dacb22a09518e4ef6ee234f2d4987 # v4.0.0
66+
# with:
67+
# github_token: ${{ secrets.GITHUB_TOKEN }}
68+
# - name: Run TFLint
69+
# run: |
70+
# tflint --init -c ${GITHUB_WORKSPACE}/.tflint.hcl
71+
# tflint -c ${GITHUB_WORKSPACE}/.tflint.hcl --var-file ${GITHUB_WORKSPACE}/.github/lint/tflint.tfvars ${{ inputs.tflint-options }}
72+
- name: tflint
73+
uses: reviewdog/[email protected]
6274
with:
63-
github_token: ${{ secrets.GITHUB_TOKEN }}
64-
- name: Run TFLint
65-
run: |
66-
tflint --init -c ${GITHUB_WORKSPACE}/.tflint.hcl
67-
tflint -c ${GITHUB_WORKSPACE}/.tflint.hcl --var-file ${GITHUB_WORKSPACE}/.github/lint/tflint.tfvars ${{ inputs.tflint-options }}
75+
tflint_init: true
76+
github_token: ${{ secrets.github_token }}
77+
tflint_config: ${GITHUB_WORKSPACE}/.tflint.hcl

.github/workflows/terraform.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
tf_modules: ${{ steps.find.outputs.modules }}
3434
tf_examples: ${{ steps.find.outputs.examples }}
3535

36-
verify_all:
36+
verify:
3737
uses: ./.github/workflows/terraform-validate-template.yml
3838
name: Verify module for Terraform ${{ matrix.terraform }}
3939
needs: dirs

0 commit comments

Comments
 (0)