SDK version
{
"Path": "github.com/hashicorp/terraform-plugin-sdk",
"Version": "v1.13.0"
}
Use-cases
When using the StringInSlice SchemaValidateFunc with valid strings that contain white spaces.
For example:
ValidateFunc: validation.StringInSlice([]string{"Base Policy", "Allow", "Deny"}, false),
If the user inputs an invalid value the error message looks like
Error: expected domain_names.0.action to be one of [Base Policy Allow Deny], got dont_allow
It is ambiguous whether "Base Policy" is a single phrase or two separate words.
Attempted Solutions
I've written my own version of StringInSlice that separates words by comma. So the error message instead looks like
Error: expected domain_names.0.action to be one of [Base Policy, Allow, Deny], got dont_allow
Proposal
By default, StringInSlice should separate valid values by comma in the error message. I would be happy to work on this as I've already done it once! 😄
References
None.
SDK version
Use-cases
When using the
StringInSliceSchemaValidateFunc with valid strings that contain white spaces.For example:
If the user inputs an invalid value the error message looks like
It is ambiguous whether "Base Policy" is a single phrase or two separate words.
Attempted Solutions
I've written my own version of
StringInSlicethat separates words by comma. So the error message instead looks likeProposal
By default,
StringInSliceshould separate valid values by comma in the error message. I would be happy to work on this as I've already done it once! 😄References
None.