-
Notifications
You must be signed in to change notification settings - Fork 21
54 lines (47 loc) · 1.17 KB
/
validate-terraform.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Check Terraform
on:
push:
branches:
- main
paths:
- 'terraform/**'
- 'terraform-bootstrap/**'
pull_request:
paths:
- 'terraform/**'
- 'terraform-bootstrap/**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.9.7"
- name: Lint Terraform code
run: terraform fmt -check -diff -recursive
validate:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
directory:
- terraform/production
- terraform/staging
- terraform-bootstrap
defaults:
run:
working-directory: ${{ matrix.directory }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "~1.9.7"
- name: Initialize Terraform (offline only)
run: terraform init -backend=false
- name: Validate Terraform code
run: terraform validate