-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
string literal "false" evaluates to "0" using null_data_source #13512
Comments
Having run into this bug yet again, I have a much simpler test case now:
What is the output, you ask?
|
Thanks for that simpler repro, @in4mer! |
So I just spent the morning walking through all of Terraform's layers and got to the bottom of what's going on here. The TLDR is that this is an unexpected interaction in how Terraform processes non-primitive values, and it's a specific symptom of a general problem we're already aware of. It's not a straightforward fix, but it will be addressed as part of some later work to rationalize how Terraform thinks about values so that type information isn't lost and imprecisely recovered as data moves between different parts of Terraform. Some gory details now, mostly for my benefit for reference later: Some context here first: Terraform currently represents values in numerous different ways at different points. For example, in state the possibly-complex structure of attributes on a resource are flattened into a So in summary, Terraform spends quite a significant amount of its code marshalling values back and forth between strings and typed values in various different type systems, using various different systems to do so. And that brings us to what's going on here:
|
I consolidated #7934 into this, but just wanted to note: that issue suggests that this bug can also affect literal maps in configuration, probably for the same reason, but that causes strange diffs to be produced and so is arguably more serious than just getting the wrong serialization in an output. |
We are experiencing this as well, the value of
|
For most bool values in Terraform, you can use true and "true" interchangeably. The bool values nested in create_vnic_details are treated differently, apprently due to hashicorp/terraform#13512: true appears as "1", while "true" appears as "true". ParseBool handles both.
Are there any workarounds? |
Hi all! Sorry for the long silence. I've been very much looking forward to verifying this one against the v0.12.0-alpha2 build because the insidiousness of this issue was one of the big motivators to rework Terraform to use the same value representations throughout and avoid all of the weird conversions I listed out in my earlier comment. I'm pleased to report that this is now working correctly in the alpha and this fix is in the master branch ready to be included in the forthcoming v0.12.0 release. With the simpler config given by @in4mer above, unmodified, the output is now as expected:
Other new features in v0.12.0 should solve the remaining cases for (ab)using Thanks for reporting this, and sorry for the delay in getting it fixed. |
@nick4fake the workaround from top of my head could be:
|
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. |
Terraform Version
0.9.2
Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Debug Output
Not even going to bother
Panic Output
The only panic this should elicit is entirely existential
Expected Behavior
The string literal "false" should not be evaluated
Actual Behavior
I don't even...
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Important Factoids
Is no one else actually using null_data_source? This is really, really frustrating.
References
Possibly ??
The text was updated successfully, but these errors were encountered: