-
Notifications
You must be signed in to change notification settings - Fork 7
56 lines (48 loc) · 1.47 KB
/
example.yml
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
55
56
name: Example CI
on:
push:
paths:
- 'example/**'
- .github/workflows/example.yml
pull_request:
paths:
- 'example/**'
- .github/workflows/example.yml
workflow_dispatch:
jobs:
validate-terraform:
strategy:
matrix:
target: [vault]
name: Check module ${{ matrix.target }}
runs-on: ubuntu-22.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 1.0.8
- name: Validate ${{ matrix.target }} modules
run: |
for module in $(find . -maxdepth 1 -mindepth 1 -type d); do
pushd $module > /dev/null
pwd
terraform init
terraform fmt --recursive -check=true
terraform validate
popd > /dev/null
done
working-directory: example/${{ matrix.target }}/modules
- name: Validate ${{ matrix.target }} environments
run: |
for env in $(find . -maxdepth 1 -mindepth 1 -type d); do
pushd $env > /dev/null
pwd
terraform init -backend=false
terraform fmt --recursive -check=true
terraform validate
popd > /dev/null
done
working-directory: example/${{ matrix.target }}/environments