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

Function setproduct() panics with empty sets/lists #28524

Closed
peikk0 opened this issue Apr 27, 2021 · 2 comments · Fixed by #28607
Closed

Function setproduct() panics with empty sets/lists #28524

peikk0 opened this issue Apr 27, 2021 · 2 comments · Fixed by #28607
Labels

Comments

@peikk0
Copy link

peikk0 commented Apr 27, 2021

Terraform Version

Terraform v0.15.1
on darwin_amd64

Terraform Configuration Files

output "panics" {
  value = setproduct([], [])
}

output "panics_too" {
  value = setproduct(["a", "b"], [])
}

output "panics_again" {
  value = setproduct([], ["c", "d"])
}

output "does_not_panic" {
  value = setproduct(["a", "b"], ["c", "d"])
}

Debug Output

https://gist.github.com/peikk0/813a660c334fef294db7b12557be9048#file-debug-log

Crash Output

https://gist.github.com/peikk0/813a660c334fef294db7b12557be9048#file-crash-log

Expected Behavior

setproduct() should not panic with empty lists or sets.

Actual Behavior

setproduct() panics with empty lists or sets.

Steps to Reproduce

  1. terraform init
  2. terraform apply

Additional Context

References

@peikk0 peikk0 added bug new new issue not yet triaged labels Apr 27, 2021
@jbardin jbardin added config dependencies Auto-pinning and removed new new issue not yet triaged labels Apr 27, 2021
@mantoine96
Copy link

mantoine96 commented Apr 29, 2021

I've encountered the same issue. It seems to be a regression between 0.15.0 and 0.15.1, as using 0.15.0 works as expected. I believe it is linked to: c0328e4

Confirmed via git bisect:

c0328e414accdd90f73f9ff17e8380f2cf67b4b9 is the first bad commit
commit c0328e414accdd90f73f9ff17e8380f2cf67b4b9
Author: The Terraform Team <52939924+teamterraform@users.noreply.github.com>
Date:   Wed Apr 21 10:11:36 2021 -0700

    dependencies: update cty from v1.8.1 to v1.8.2

    This includes the improvements to various collection-related functions to
    make them handle marks more precisely. For Terraform in particular that
    translates into handling sensitivity more precisely, so that non-sensitive
    collections that happen to contain sensitive elements won't get simplified
    into wholly-sensitive collections when using these functions.

 go.mod | 2 +-
 go.sum | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
bisect run success

I have opened an issue and a PR on go-cty:

@github-actions
Copy link

github-actions bot commented Jun 4, 2021

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants