generated from DNXLabs/terraform-aws-template
-
Notifications
You must be signed in to change notification settings - Fork 4
51 lines (47 loc) · 1.17 KB
/
validate.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
name: validate
on:
pull_request_target:
types: [opened, synchronize]
jobs:
tf-lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- uses: terraform-linters/setup-tflint@v2
name: Setup TFLint
- name: Show version
run: tflint --version
- name: Init TFLint
run: tflint --init
- name: Run TFLint
run: tflint
tf-fmt:
name: Code Format
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
- run: terraform fmt --recursive -check=true
tf-validate:
name: Validate
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:latest
steps:
- uses: actions/checkout@v3
- name: Validate Code
env:
AWS_REGION: us-east-1
TF_WARN_OUTPUT_ERRORS: 1
run: |
terraform init
terraform validate
- name: Validate Examples
run: |
for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do
cd $example
terraform init
terraform validate
cd -
done