-
Notifications
You must be signed in to change notification settings - Fork 7
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
Nat gateway cannot be created due to depends on subnet creation. #1
Comments
Hello @djcldcvr, This issue is a common one and is due to a Terraform limitation, see hashicorp/terraform#4149. Can you please provide your code that leads to this issue ? We may be able to provide a workaround. |
Hi @BzSpi Thanks for your prompt response. Please refer to the below given code that leads to reported issue.
|
Hi @djcldcvr, like @BzSpi said, that's a Terraform bug. and then, update the code with and apply again to update subnets associated to the NAT GW. (or you can apply with -target option like Terraform suggests in order to apply first the Subnet creation, and then another global apply) |
Hello ! Original issue hashicorp/terraform#4149 has been closed and replaced by a new one hashicorp/terraform#30937. No answers since november 2021, i'll close this issue. Don't hesitate to reply here and we'll re-open it if needed. Thanks for your issue ! |
│ Error: Invalid for_each argument
│
│ on terraform-azurerm-nat-gateway/r-nat-gateway.tf line 42, in resource "azurerm_subnet_nat_gateway_association" "subnet_assoc":
│ 42: for_each = toset(var.subnet_ids)
│ ├────────────────
│ │ var.subnet_ids is list of string with 1 element
│
│ The "for_each" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many
│ instances will be created. To work around this, use the -target argument to first apply only the resources that the for_each
│ depends on.
The text was updated successfully, but these errors were encountered: