Skip to content

Commit bec7fed

Browse files
committed
ci: add GitHub Actions workflow for terraform validate and lint
1 parent 4f8660d commit bec7fed

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/terraform-ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Terraform CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
13+
jobs:
14+
terraform:
15+
name: Terraform Validate & Lint
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Terraform
23+
uses: hashicorp/setup-terraform@v3
24+
with:
25+
terraform_version: 1.7.0
26+
27+
- name: Terraform Format Check
28+
run: terraform fmt -check -recursive
29+
30+
- name: Terraform Init
31+
run: terraform init -backend=false
32+
33+
- name: Terraform Validate
34+
run: terraform validate
35+
36+
- name: Setup TFLint
37+
uses: terraform-linters/setup-tflint@v4
38+
39+
- name: Run TFLint
40+
run: tflint --recursive
41+
42+
- name: Run Checkov
43+
uses: bridgecrewio/checkov-action@v12
44+
with:
45+
directory: .
46+
quiet: true
47+
soft_fail: true

0 commit comments

Comments
 (0)