File tree Expand file tree Collapse file tree 3 files changed +24
-17
lines changed Expand file tree Collapse file tree 3 files changed +24
-17
lines changed Original file line number Diff line number Diff line change 4
4
pull_request :
5
5
paths :
6
6
- ' **.tf'
7
+ - ' .pre-commit-config.yaml'
7
8
push :
8
9
branches :
9
10
- master
Original file line number Diff line number Diff line change @@ -12,19 +12,22 @@ repos:
12
12
# "Error: Provider configuration not present" error
13
13
# https://github.com/hashicorp/terraform/issues/21416
14
14
# https://discuss.hashicorp.com/t/how-to-run-terraform-validate-on-a-module-that-is-supplied-the-providers-via-an-alias/34664/2
15
- - repo : local
16
- hooks :
17
- - id : terraform_validate
18
- name : Terraform validate
19
- entry : .pre-commit-terraform-validate-examples.sh
20
- pass_filenames : false
21
- language : script
15
+ # - repo: local
16
+ # hooks:
17
+ # - id: terraform_validate
18
+ # name: Terraform validate
19
+ # entry: .pre-commit-terraform-validate-examples.sh
20
+ # pass_filenames: false
21
+ # language: script
22
+ # verbose: true
22
23
23
24
- repo : git://github.com/antonbabenko/pre-commit-terraform
24
- rev : v1.50 .0
25
+ rev : v1.64 .0
25
26
hooks :
26
27
- id : terraform_fmt
27
- # - id: terraform_validate
28
+ # https://github.com/antonbabenko/pre-commit-terraform#terraform_validate
29
+ - id : terraform_validate
30
+ exclude : (modules/infrastructure/permissions/org-role-ecs)|(examples/organizational)|(test)|(examples-internal)\/.*$
28
31
- id : terraform_docs
29
32
args :
30
33
- ' --args=--sort-by required'
45
48
- ' --args=--only=terraform_standard_module_structure'
46
49
- ' --args=--only=terraform_workspace_remote'
47
50
- repo : git://github.com/pre-commit/pre-commit-hooks
48
- rev : v4.0.1
51
+ rev : v4.1.0
49
52
hooks :
50
53
- id : check-merge-conflict
51
54
- id : end-of-file-fixer
Original file line number Diff line number Diff line change 4
4
set -o errexit
5
5
6
6
# cleanup
7
+ echo " cleaning .terraform state"
7
8
bash ./resources/terraform-clean.sh
8
9
9
- for dir in examples * / *
10
+ for dir in $( find . -name ' versions.tf ' -not -path ' *.terraform* ' -exec dirname {} \; )
10
11
do
11
-
12
+ echo validating [ $dir ]
12
13
# skip aliased providers due to terraform validate unresolved bug
13
14
# https://github.com/hashicorp/terraform/issues/28490
14
- if [ $dir == " examples/organizational" ]; then
15
+ if [ " $dir " == " examples/organizational" ]; then
15
16
echo " skipping validation on [$dir ]"
16
17
break
17
18
fi
18
- echo validating example [$dir ]
19
- cd $dir
20
- terraform init
19
+ pushd .
20
+ cd " $dir "
21
+ # force init
22
+ # https://github.com/antonbabenko/pre-commit-terraform/issues/224
23
+ terraform init --upgrade
21
24
terraform validate
22
- cd ../..
25
+ popd
23
26
done
You can’t perform that action at this time.
0 commit comments