1- name : Infrastructure Checks
1+ name : Lint and Validate Terraform
22
33on :
44 push :
55 paths :
6- - ' **/*.tf'
7- - ' .github/workflows/infrastructure-checks .yml'
6+ - " **/*.tf"
7+ - " .github/workflows/lint-and-validate-terraform .yml"
88 workflow_dispatch :
99
10+ permissions :
11+ contents : read
12+ checks : write
13+
1014jobs :
1115 terraform_validation :
1216 name : Terraform Lint and Validate
@@ -15,28 +19,20 @@ jobs:
1519 run :
1620 shell : bash
1721 steps :
18- - name : Harden the runner (Audit all outbound calls)
22+ - name : Harden the runner (audit all outbound calls)
1923 uses : step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 # v2.12.2
2024 with :
2125 egress-policy : audit
22-
23- - name : Checkout Repository
26+ - name : Checkout repository
2427 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.4.2
25-
26- - name : Setup Terraform
27- # This action installs a specific version of Terraform.
28+ - name : Install Terraform
2829 uses : hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
2930 with :
30- terraform_version : 1.9.0
31-
32- - name : Terraform Format Check
31+ terraform_version : 1.9.0
32+ - name : terraform fmt -check=true -recursive
3333 run : terraform fmt -check=true -recursive
34-
35- - name : Terraform Init
36- run : terraform init -backend=false
37-
38- - name : Terraform Validate
39- run : terraform validate
34+ - name : terraform validate
35+ run : terraform init -backend=false && terraform validate
4036
4137 call_tflint_workflow :
4238 name : Run TFLint
0 commit comments