-
Notifications
You must be signed in to change notification settings - Fork 97
82 lines (67 loc) · 1.93 KB
/
auto.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Automatic CI for TFE Modules
on:
pull_request:
branches:
- main
defaults:
run:
shell: bash
jobs:
terraform_format:
name: Run terraform fmt
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.14.7
- name: Format all .tf files recursively
run: |
terraform fmt -check -diff -recursive ${{ github.workspace }}
terraform_lint:
name: Run terraform-lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Setup Terraform Lint
uses: terraform-linters/setup-tflint@ba6bb2989f94daf58a4cc6eac2c1ca7398a678bf # v3.0.0
with:
tflint_version: v0.26.0
- name: Lint root module
run: |
tflint --config ${{ github.workspace }}/.tflint.hcl ${{ github.workspace }}
- name: Lint modules directory in a loop
run: |
for m in $(ls -1d modules/*/)
do
tflint \
--config ${{ github.workspace }}/.tflint.hcl \
${{ github.workspace }}/${m}
done
- name: Lint tests directory in a loop
run: |
for m in $(ls -1d tests/*/)
do
tflint \
--config ${{ github.workspace }}/.tflint.hcl \
${{ github.workspace }}/${m}
done
- name: Lint examples directory in a loop
run: |
for m in $(ls -1d examples/*/)
do
tflint \
--config ${{ github.workspace }}/.tflint.hcl \
${{ github.workspace }}/${m}
done