1
1
repos :
2
2
- repo : https://github.com/antonbabenko/pre-commit-terraform
3
- rev : v1.99.4
3
+ rev : v1.88.2
4
4
hooks :
5
5
- id : terraform_fmt
6
6
- id : terraform_wrapper_module_for_each
@@ -22,44 +22,11 @@ repos:
22
22
- ' --args=--only=terraform_required_providers'
23
23
- ' --args=--only=terraform_standard_module_structure'
24
24
- ' --args=--only=terraform_workspace_remote'
25
+ - ' --args=--only=terraform_unused_required_providers'
25
26
- id : terraform_validate
26
- - id : terraform_tfsec
27
- args :
28
- - ' --args=--soft-fail'
29
27
- repo : https://github.com/pre-commit/pre-commit-hooks
30
- rev : v5.0 .0
28
+ rev : v4.5 .0
31
29
hooks :
32
30
- id : check-merge-conflict
33
31
- id : end-of-file-fixer
34
32
- id : trailing-whitespace
35
- - id : check-yaml
36
- - repo : local
37
- hooks :
38
- - id : validate-opensearch-version
39
- name : Validate OpenSearch Engine Version
40
- entry : bash -c
41
- args :
42
- - |
43
- # Check for engine_version in Terraform files
44
- if grep -r "engine_version.*=" . --include="*.tf" | grep -v "null" | grep -v "variables.tf" | grep -v "#"; then
45
- echo "Found engine_version configurations:"
46
- grep -r "engine_version.*=" . --include="*.tf" | grep -v "null" | grep -v "variables.tf" | grep -v "#"
47
- echo ""
48
- echo "⚠️ VALIDATION: Please ensure engine_version follows format 'OpenSearch_X.Y'"
49
- echo "❌ BAD: OpenSearch_2_19_R20250630-P5 (software service version)"
50
- echo "✅ GOOD: OpenSearch_2.19 (engine version)"
51
- echo ""
52
- # Extract and validate versions
53
- versions=$(grep -r "engine_version.*=" . --include="*.tf" | grep -v "null" | grep -v "variables.tf" | grep -v "#" | sed 's/.*engine_version.*=.*"\([^"]*\)".*/\1/' | sort | uniq)
54
- for version in $versions; do
55
- if [[ $version =~ ^OpenSearch_[0-9]{1,2}\.[0-9]{1,2}$ ]] || [[ $version =~ ^Elasticsearch_[0-9]{1}\.[0-9]{1,2}$ ]]; then
56
- echo "✅ Valid version: $version"
57
- else
58
- echo "❌ Invalid version: $version"
59
- echo " Must match pattern: OpenSearch_X.Y or Elasticsearch_X.Y"
60
- exit 1
61
- fi
62
- done
63
- fi
64
- language : system
65
- pass_filenames : false
0 commit comments