-
Notifications
You must be signed in to change notification settings - Fork 232
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
Stop silently converting map Elem from Resource to TypeString #78
Comments
oh, I'd argue the correct solution is for me to go and fix all the providers which are broken. I'm not saying we should just remove the coercion and call it a day. |
I completely agree with you that we should treat such schema as invalid, in fact that's exactly what I did in hashicorp/terraform#12638 and then I realized I broke many acceptance tests across 4 different providers - as mentioned in hashicorp/terraform#12722 It seems that for common use cases these schemas are "kind of working" (based on passing acceptance tests) - which also scares me a bit, but hey 🤷♂️ If you are (or anyone else is) willing to modify all those schemas and tighten the validation I'm totally willing to review & merge a PR. 😉 |
It's comforting to know I wasn't the only one who's made this mistake! |
This is the same as #62 , merging with that one. |
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Proposed resolution: modify all the schemas which use
Type: TypeMap
withElem: Resource
; then tighten this validation ingetValueType()
Arguably a follow on to hashicorp/terraform#12638
In
helper/schema/schema.go:getValueType
we see:This has allowed us to write a provider which looks like it's actually validating its elements, but does no such thing.
I do notice this was originally introduced by @radeksimko in hashicorp/terraform@1df1c21
Expected Behavior
getValueType()
should have returned an error like"create_vnic_details: unexpected map value type: schema.Resource"
Actual Behavior
Silently allowed using
create_vnic_details.assign_public_ip
but instead of rendering as"true"
or"false"
, renders as"1"
or"0"
Steps to Reproduce
I can do an actual test of this if desired.
Create a provider with the above schema, then use to access
create_vnic_details.assign_public_ip
The text was updated successfully, but these errors were encountered: