-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (36 loc) · 1.25 KB
/
terraform.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
name: Terraform
on:
- pull_request
env:
TF_PLUGIN_CACHE_DIR: ${{ github.workspace }}/.terraform.d/plugin-cache
jobs:
fmt:
name: "fmt"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.5.5"
- name: Terraform fmt
run: terraform fmt -recursive -write=false -check -diff .
continue-on-error: true
validate:
name: "validate"
runs-on: ubuntu-latest
strategy:
matrix:
terraform_version: ["1.5.5"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform ${{ matrix.terraform_version }}
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform_version }}
- name: Terraform Validate Root
run: cd "${GITHUB_WORKSPACE}" && terraform init -backend=false && CLOUDSDK_COMPUTE_REGION=us-central1 terraform validate -no-color
- name: Terraform Validate Examples
run: for example in examples/*/; do cd "${GITHUB_WORKSPACE}/${example}" && terraform init -backend=false && CLOUDSDK_COMPUTE_REGION=us-central1 terraform validate -no-color ; done