-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Panic on apply after destroy #12183
Comments
I've narrowed down the issue. In my configs, I'm grabbing the value of a nested attribute (which is a list of maps): frontend_ip_configuration_name = "${lookup(azurerm_lb.demo.frontend_ip_configuration[0], "name")}" Where that is defined as resource "azurerm_lb" "demo" {
name = "demo"
location = "${var.azurerm_location}"
resource_group_name = "${azurerm_resource_group.demo.name}"
frontend_ip_configuration {
name = "default"
public_ip_address_id = "${azurerm_public_ip.demo.id}"
private_ip_address_allocation = "dynamic"
}
} It looks like the graph isn't correctly setting up that dependency. |
On first look, it appears the graph is being setup properly. This looks like something else. I'm not 100% sure yet but your lookup is weird. I'm not saying you're doing something wrong, but its a usage style that I haven't seen often and I'm not sure how that plays well with computed maps. Do you have a consistent reproduction? I can play with this tomorrow. |
Fixes #12183 The fix is in flatmap for this but the entire issue is a bit more complex. Given a schema with a computed set, if you reference it like this: lookup(attr[0], "field") And "attr" contains a computed set within it, it would panic even though "field" is available. There were a couple avenues I could've taken to fix this: 1.) Any complex value containing any unknown value at any point is entirely unknown. 2.) Only the specific part of the complex value is unknown. I took route 2 so that the above works without any computed (since "name" is not computed but something else is). This may actually have an effect on other parts of Terraform configs, however those similar configs would've simply crashed previously so it shouldn't break any pre-existing configs.
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. |
Hi there,
Terraform Version
Affected Resource(s)
Panic Output
https://gist.github.com/sethvargo/9ca97d49f4e754607906bf63db54446b
Expected Behavior
Terraform should not have crashed.
Actual Behavior
Terraform crashed.
Steps to Reproduce
Steps to Fix
Important Factoids
The text was updated successfully, but these errors were encountered: