forked from hashicorp/terraform-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (80 loc) · 4.23 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Acceptance Test Linting
on:
push:
branches:
- main
- "release/**"
pull_request:
paths:
- .github/workflows/acctest-terraform-lint.yml
- .go-version
- aws/*_test.go
- scripts/validate-terraform.sh
- tools/go.mod
jobs:
terrafmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# See also: https://github.com/actions/setup-go/pull/62
- run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v2
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: terrafmt diff ./aws --check --pattern '*_test.go' --fmtcompat
- run: |
# resource_aws_ecs_capacity_provider_test.go: two format verbs on one line (%[2]q = %[3]q). https://github.com/katbyte/terrafmt/issues/46
# resource_aws_efs_file_system_test.go: argument name is format verb and replaced with quoted string. https://github.com/katbyte/terrafmt/issues/47
# resource_aws_kms_grant_test.go: argument name is format verb and replaced with quoted string. https://github.com/katbyte/terrafmt/issues/47
# resource_aws_quicksight_user_test.go: format verb as resource name (%[1]q). https://github.com/katbyte/terrafmt/issues/48
# resource_aws_sns_platform_application_test.go: argument name is format verb and replaced with quoted string. https://github.com/katbyte/terrafmt/issues/47
find ./aws -type f -name '*_test.go' \
| sort -u \
| grep -v resource_aws_ecs_capacity_provider_test.go \
| grep -v resource_aws_efs_file_system_test.go \
| grep -v resource_aws_kms_grant_test.go \
| grep -v resource_aws_quicksight_user_test.go \
| grep -v resource_aws_s3_bucket_object_test.go \
| grep -v resource_aws_sns_platform_application_test.go \
| xargs -I {} terrafmt diff --check --fmtcompat {}
validate-terraform:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# See also: https://github.com/actions/setup-go/pull/62
- run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/cache@v2
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
- run: |
# resource_aws_ecs_capacity_provider_test.go: two format verbs on one line (%[2]q = %[3]q). https://github.com/katbyte/terrafmt/issues/46
# resource_aws_efs_file_system_test.go: argument name is format verb and replaced with quoted string. https://github.com/katbyte/terrafmt/issues/47
# resource_aws_kms_grant_test.go: argument name is format verb and replaced with quoted string. https://github.com/katbyte/terrafmt/issues/47
# resource_aws_lambda_permission_test.go: format verb as resource name ("%s"). https://github.com/katbyte/terrafmt/issues/48
# resource_aws_quicksight_user_test.go: format verb as resource name (%[1]q). https://github.com/katbyte/terrafmt/issues/48
# resource_aws_sns_platform_application_test.go: argument name is format verb and replaced with quoted string. https://github.com/katbyte/terrafmt/issues/47
find ./aws -type f -name '*_test.go' \
| sort -u \
| grep -v resource_aws_ecs_capacity_provider_test.go \
| grep -v resource_aws_efs_file_system_test.go \
| grep -v resource_aws_kms_grant_test.go \
| grep -v resource_aws_lambda_permission_test.go \
| grep -v resource_aws_quicksight_user_test.go \
| grep -v resource_aws_s3_bucket_object_test.go \
| grep -v resource_aws_sns_platform_application_test.go \
| ./scripts/validate-terraform.sh