generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (53 loc) · 1.23 KB
/
terraformChecks.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: Terraform checks
on:
workflow_dispatch:
inputs:
environment:
description: Environment to deploy to
type: environment
required: true
pull_request:
branches:
- "**"
paths:
- terraform/**
jobs:
check-terraform-formatting:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./terraform
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Check format
run: terraform fmt -check -recursive
check-terraform-validity:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./terraform
env:
TERRAFORM_DIRS: |
aws/setup
aws/implementation
azure/setup
azure/implementation
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- name: Terraform Init
run: |
for d in $TERRAFORM_DIRS
do
echo "Initializing $d";
(cd $d && terraform init -backend=false)
done
- name: Terraform Validate
run: |
for d in $TERRAFORM_DIRS
do
echo "Validating $d";
(cd $d && terraform validate)
done