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 44 pull_request :
55 paths :
66 - ' **.tf'
7+ - ' .pre-commit-config.yaml'
78 push :
89 branches :
910 - master
Original file line number Diff line number Diff line change @@ -12,19 +12,22 @@ repos:
1212 # "Error: Provider configuration not present" error
1313 # https://github.com/hashicorp/terraform/issues/21416
1414 # 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
2223
2324 - repo : git://github.com/antonbabenko/pre-commit-terraform
24- rev : v1.50 .0
25+ rev : v1.64 .0
2526 hooks :
2627 - 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)\/.*$
2831 - id : terraform_docs
2932 args :
3033 - ' --args=--sort-by required'
4548 - ' --args=--only=terraform_standard_module_structure'
4649 - ' --args=--only=terraform_workspace_remote'
4750 - repo : git://github.com/pre-commit/pre-commit-hooks
48- rev : v4.0.1
51+ rev : v4.1.0
4952 hooks :
5053 - id : check-merge-conflict
5154 - id : end-of-file-fixer
Original file line number Diff line number Diff line change 44set -o errexit
55
66# cleanup
7+ echo " cleaning .terraform state"
78bash ./resources/terraform-clean.sh
89
9- for dir in examples * / *
10+ for dir in $( find . -name ' versions.tf ' -not -path ' *.terraform* ' -exec dirname {} \; )
1011do
11-
12+ echo validating [ $dir ]
1213 # skip aliased providers due to terraform validate unresolved bug
1314 # https://github.com/hashicorp/terraform/issues/28490
14- if [ $dir == " examples/organizational" ]; then
15+ if [ " $dir " == " examples/organizational" ]; then
1516 echo " skipping validation on [$dir ]"
1617 break
1718 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
2124 terraform validate
22- cd ../..
25+ popd
2326done
You can’t perform that action at this time.
0 commit comments