-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Regression: Incorrect marshaling of data types in JSON #31894
Comments
Thanks for the report and the reduced reproduction case! The change in behaviour you've found is unfortunate, but the previous behaviour was incorrect, and Terraform is now working as designed. I believe the change responsible is the fix for #27966, which is described in zclconf/go-cty#89. First I'd like to explain what's happening here, and then later offer some suggestions as to how you can update your configuration to work with the new behaviour. Using the recently-added
Similarly
When concatenating these two different typed values, Terraform must determine a unified type for the list. Lists in Terraform must have a single element type, and all elements must convert to that type. With the information in the configuration, the only unified type available for these two object types is Because There are several ways that you can work around this behaviour to achieve the result I think you are looking for. First, you can use the new
Alternatively, you can use a
Finally, you can explicitly type-convert the
I hope one of these options works for your real use case, and let me know if you have any follow-up questions. Since this doesn't represent a bug in Terraform, I'm going to close this issue. Thanks again for the report. |
@alisdair That is an unfortunate change in behavior from 0.14 to 0.15, but I understand why, and I appreciate the detailed explanation. I was able to remediate my configuration quite easily by, as you suggested, explicitly casting the value as follows: This particular module where I ran into this is still designed to be compatible with TF 0.13+, so I can't yet take advantage of Thanks! |
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. |
Terraform Version
Terraform Configuration Files
Debug Output
none
Expected Behavior
readOnly
should be encoded as aboolean
Actual Behavior
readOnly
is encoded as astring
Steps to Reproduce
Additional Context
Under Terraform 0.14.11, the plan produced by this configuration is as follows:
Using Terraform 0.15.5, the plan is different:
Note that the
readOnly
attribute in 0.14.11 is encoded as aboolean
, while in 0.15.5 it is encoded as astring
. Replacingconcat(var.foo, var.bar)
withvar.bar
in this example resolves this issue, so there appears to be some sort of regression in the way objects are iterated after concatenation.Terraform v1.2.9 produces a similar plan to v0.15.5.
References
cloudposse/terraform-aws-ecs-container-definition#108
The text was updated successfully, but these errors were encountered: