-
Notifications
You must be signed in to change notification settings - Fork 18
66 lines (61 loc) · 1.57 KB
/
lint.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
57
58
59
60
61
62
63
64
65
66
name: Lint
on: [push]
jobs:
tflint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.tflint.d/plugins
key: tflint-${{ hashFiles('.tflint.hcl') }}
- uses: terraform-linters/setup-tflint@v3
- run: tflint --version
- run: tflint --init
- run: tflint -f compact
fmt:
name: Code Format
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:latest
steps:
- uses: actions/checkout@v3
- run: terraform fmt --recursive -check=true
validate:
name: Validate
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:1.5.1
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
minimum:
name: Minimum version check
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:1.5.1
steps:
- uses: actions/checkout@v3
- name: Validate Code
env:
AWS_REGION: 'us-east-1'
TF_WARN_OUTPUT_ERRORS: 1
run: |
sed -i -e 's/>=/=/' -e 's/ \(\d\+\.\d\+\)"/ \1.0"/' versions.tf
terraform init
terraform validate