Skip to content
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

Conditionals not working correctly with chunklist #22100

Closed
melbit-michaelw opened this issue Jul 17, 2019 · 2 comments · Fixed by #22137
Closed

Conditionals not working correctly with chunklist #22100

melbit-michaelw opened this issue Jul 17, 2019 · 2 comments · Fixed by #22137

Comments

@melbit-michaelw
Copy link

melbit-michaelw commented Jul 17, 2019

Terraform Version

Terraform v0.12.4

Terraform Configuration Files

output "test_result" {
   value = 0 > 0 ? zipmap([], chunklist(["a", "b"], 3)) : {}
 }

 output "test_result2" {
   value = 0 > 0 ? zipmap([], []) : {}
 }

Debug Output

https://gist.github.com/melbit-michaelw/2d7f3cf032853deb2a683480dd8cc9d1

Crash Output

n/a

Expected Behavior

Outputs for both test_result and test_result2, both of which should be empty maps.

Actual Behavior

Only test_result2 produces an output.


Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

test_result2 = {}

In our case, we have a submodule with an output that is used as an input to another module which is hitting this bug. This then fails with an error about "unknown values during apply (this is a bug in Terraform; please report it!)".

Steps to Reproduce

Using the example terraform code,

  1. terraform init
  2. terraform apply

Additional Context

References

This looks similar to #21455

@melbit-michaelw
Copy link
Author

Just to add some more details, the 'true' path on the conditionals (which is the part that contains chunklist) shouldn't actually be evaluated, since 0 is not > 0.

I'm not sure why the presence of chunklist in the 'true' path causes the test_result output to be removed.

@ghost
Copy link

ghost commented Aug 18, 2019

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.

@ghost ghost locked and limited conversation to collaborators Aug 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants