Skip to content

Commit cb51001

Browse files
chore(infra): validate terraform stacks on pull requests
run fmt-check, init -backend=false, and validate for gcp/aws/az/oci on prs touching apps/infra; no cloud credentials required Co-Authored-By: First Fluke <our.first.fluke@gmail.com>
1 parent 0d90c20 commit cb51001

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/terraform-ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Terraform CI
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "apps/infra/**"
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: terraform-ci-${{ github.head_ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
validate:
17+
name: Validate (${{ matrix.stack }})
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
stack: [gcp, aws, az, oci]
23+
24+
defaults:
25+
run:
26+
working-directory: apps/infra/${{ matrix.stack }}
27+
28+
steps:
29+
- uses: actions/checkout@v5
30+
31+
- name: Set up Terraform
32+
uses: hashicorp/setup-terraform@v3
33+
34+
- name: Terraform fmt check
35+
run: terraform fmt -check -recursive
36+
37+
- name: Terraform init
38+
run: terraform init -backend=false
39+
40+
- name: Terraform validate
41+
run: terraform validate
42+
43+
- name: Write job summary
44+
if: always()
45+
run: |
46+
echo "| Stack | Step | Result |" >> $GITHUB_STEP_SUMMARY
47+
echo "|-------|------|--------|" >> $GITHUB_STEP_SUMMARY
48+
echo "| ${{ matrix.stack }} | fmt / init / validate | ${{ job.status }} |" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)