Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
string literal "false" evaluates to "0" using null_data_source #13512
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
Not even going to bother
The only panic this should elicit is entirely existential
The string literal "false" should not be evaluated
I don't even...
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
Is no one else actually using null_data_source? This is really, really frustrating.
Having run into this bug yet again, I have a much simpler test case now:
What is the output, you ask?
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
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.