-
Notifications
You must be signed in to change notification settings - Fork 12
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
RequiredWhenStringValueAtAnyOf() #113
Comments
Thanks for raising this, @chrismarget. 👍 My focus is elsewhere at the moment, but I wanted to drop some potential considerations here for you and future travelers. A potential concern (outside booleans) is that using a single, static value associated with a Go built-in value type may become a scalability issue for this Go module. For example, strings might be desirable to be tested against regular expressions or numbers against ranges. To mitigate that sort of concern, something to potentially consider in this context is whether something like a generic validation framework around "if" conditionals may be a less-specific solution to reduce the surface area to introduce type of functionality. Back with terraform-plugin-sdk, the Potentially more outlandish in that space would be meta if-then support. Maybe something like Another way to potentially frame this problem and potential solution is validating the opposite way -- similar to the existing The joy of trying to design these. 😄 |
Hi @bflad, I really like the Did ground rules for validator inclusion in this repo come together last week? |
Terraform CLI and Framework Versions
any
Use Cases or Problem Statement
I have a need for schema attributes to be recognized as mandatory when certain values appear in other attributes.
For example, when
mode
is"complicated"
,complicated_mode_params
should be required.I'm thinking something like this:
Proposal
This situation could be generalized with validators for each attribute type which check for trigger values in other attributes of all types:
Same for
int64Validator
,mapValidator
,boolValidator
, etc...Comments elsewhere from @bflad indicate you're planning to set ground rules for validator inclusion this Friday, so I'm opening this issue with that in mind.
If there's interest, I could take a crack at it.
Additional Information
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: