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

for_each crashes on null_resource with local-exec provisioner #22413

Closed
adarobin opened this issue Aug 9, 2019 · 5 comments
Closed

for_each crashes on null_resource with local-exec provisioner #22413

adarobin opened this issue Aug 9, 2019 · 5 comments
Assignees

Comments

@adarobin
Copy link

adarobin commented Aug 9, 2019

Terraform Version

Terraform v0.12.6
+ provider.null v2.1.2

Terraform Configuration Files

variable "test" {
    default = {
        foo = "bar"
    }
}

resource "null_resource" "test" {
    for_each = var.test

    triggers = {
        foo = each.key
    }

    provisioner "local-exec" {
        command = "echo ${each.value}"
    }
}

Debug Output

https://gist.github.com/adarobin/5c7a6449bd6c2a0ace6550f9f64219a7

Crash Output

https://gist.github.com/adarobin/16994b75a44f3bd8eff8efa9287d4d22

Expected Behavior

The apply was successful.

Actual Behavior

Terraform crashed

Steps to Reproduce

  1. terraform init
  2. terraform apply

Additional Context

Interestingly, this works and does not crash

variable "test" {
    default = {
        foo = "bar"
    }
}

resource "null_resource" "test" {
    for_each = var.test

    triggers = {
        foo = each.key
    }

    provisioner "local-exec" {
        command = "echo ${var.test[each.key]}"
    }
}

References

@pselle
Copy link
Contributor

pselle commented Aug 9, 2019

@adarobin Thank you for this report! I believe it's a duplicate of #22289, and there's a fix in master that will go out in the next release of Terraform (0.12.7), and I'll leave this open until that's out to help future reporters. Thank you!

@pselle pselle self-assigned this Aug 9, 2019
@xbaran
Copy link

xbaran commented Aug 21, 2019

Same problem here.

@FrantisekLee
Copy link

The same problem...

@pselle
Copy link
Contributor

pselle commented Aug 22, 2019

Terraform 0.12.7 (with this fix) is now released! https://github.com/hashicorp/terraform/blob/v0.12.7/CHANGELOG.md

@pselle pselle closed this as completed Aug 22, 2019
@ghost
Copy link

ghost commented Sep 22, 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 Sep 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants