-
Notifications
You must be signed in to change notification settings - Fork 2
35 lines (33 loc) · 1.04 KB
/
test.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
name: Pull Request
on:
pull_request:
branches:
- main
jobs:
provide_modules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: echo "::set-output name=matrix::$(find modules -mindepth 1 -maxdepth 1 -type d | jq -R | jq -sc)"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
validate:
needs: provide_modules
strategy:
matrix:
module: ${{ fromJson(needs.provide_modules.outputs.matrix) }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ matrix.module }}
steps:
- uses: actions/checkout@v4
- name: Extract Terraform version from constraints in module
run: echo TF_VERSION=$(grep "^[[:space:]]\+required_version = \"" providers.tf | cut -d= -f2- | tr -d ' "') >> $GITHUB_ENV
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- run: terraform fmt -check -recursive
- run: terraform init -input=false
- run: terraform validate