-
Notifications
You must be signed in to change notification settings - Fork 8.9k
66 lines (57 loc) · 1.74 KB
/
acctest-terraform-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: Acceptance Test Linting
on:
push:
branches:
- main
- "release/**"
pull_request:
paths:
- .github/workflows/acctest-terraform-lint.yml
- .go-version
- .tflint.hcl
- 'internal/service/**/*_test.go'
- scripts/validate-terraform.sh
- tools/go.mod
jobs:
terrafmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: .go-version
- uses: actions/cache@v3
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- run: cd tools && go install github.com/katbyte/terrafmt
- run: |
find ./internal/service -type f -name '*_test.go' \
| sort -u \
| xargs -I {} terrafmt diff --check --fmtcompat {}
validate-terraform:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: .go-version
- uses: actions/cache@v3
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- run: cd tools && go install github.com/katbyte/terrafmt
- run: cd tools && go install github.com/terraform-linters/tflint
- uses: actions/cache@v3
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ${{ runner.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
- run: tflint --init
- run: |
find ./internal/service -type f -name '*_test.go' \
| ./scripts/validate-terraform.sh