-
-
Notifications
You must be signed in to change notification settings - Fork 52
feat: Add variable validation rules to engine_version to prevent invalid formats
#42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add variable validation rules to engine_version to prevent invalid formats
#42
Conversation
- Add comprehensive input validation for engine_version variable - Prevent software service versions (e.g., OpenSearch_2_19_R20250630-P5) - Enforce correct AWS engine version format (OpenSearch_X.Y) - Add length validation (≤18 chars) to catch overly long versions - Include clear error messages with examples of valid formats - Add pre-commit hook for engine version validation - Prevents accidental domain destruction from invalid version changes Fixes issue where users mistakenly use software service versions instead of engine versions, causing domain recreation failures.
.pre-commit-config.yaml
Outdated
| - '--args=--only=terraform_standard_module_structure' | ||
| - '--args=--only=terraform_workspace_remote' | ||
| - id: terraform_validate | ||
| - id: terraform_tfsec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the variable changes are ok, but lets revert any changes on the pre-commit config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bryantbiggs Thanks for the review. I have revert the changes to the .pre-commit-config.yaml file.
engine_version to prevent invalid formats
7577cba to
3a7ab05
Compare
## [2.1.0](v2.0.0...v2.1.0) (2025-08-27) ### Features * Add variable validation rules to `engine_version` to prevent invalid formats ([#42](#42)) ([8fd929b](8fd929b))
|
This PR is included in version 2.1.0 🎉 |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
This PR adds comprehensive input validation for the
engine_versionvariable to prevent users from accidentally using invalid version formats that cause OpenSearch domain destruction and recreation failures.Key Changes:
engine_versionvariable invariables.tf.pre-commit-config.yamlwith custom engine version validation hookProblem Solved:
Users were mistakenly using software service versions (e.g.,
OpenSearch_2_19_R20250630-P5) instead of engine versions (e.g.,OpenSearch_2.19), causing:terraform applyMotivation and Context
This change is required to prevent a critical issue where users confuse software service versions with engine versions.
Real-world incident:
OpenSearch_2_19_R20250630-P5Member must satisfy regular expression pattern: ^Elasticsearch_[0-9]{1}\.[0-9]{1,2}$|^OpenSearch_[0-9]{1,2}\.[0-9]{1,2}$Root Cause:
engine_versionvariableBreaking Changes
No breaking changes. This is purely additive validation that:
terraform planvsterraform apply)Existing valid configurations like
engine_version = "OpenSearch_2.11"continue to work unchanged.How Has This Been Tested?
Validation Testing
Regex Pattern Testing: Validated regex patterns against known valid and invalid formats:
OpenSearch_1.3,OpenSearch_2.11,OpenSearch_2.15,Elasticsearch_7.10OpenSearch_2_19_R20250630-P5,OpenSearch_2.19.1,2.19Length Validation Testing: Confirmed 18-character limit catches software service versions:
OpenSearch_2.11(14 chars)OpenSearch_2_19_R20250630-P5(29 chars)Error Message Testing: Verified clear, actionable error messages are displayed
Pre-commit Testing
Compatibility Testing
engine_version = null(default) continues to workManual Testing Scenarios
Testing Commands:
Testing Checklist
examples/*to demonstrate and validate my change(s)examples/*projectsexamples/complete- no impact on valid configurationspre-commit run -aon my pull requestAdditional Testing: