│ Error: Invalid for_each argument
│
│ on boundary/hosts.tf line 9, in resource "boundary_host" "backend_servers":
│ 9: for_each = var.target_ips
│ ├────────────────
│ │ var.target_ips is set 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.
boundary/vars.tf
variable "target_ips" {
type = set(string)
default = []
}
boundary/hosts.tf
resource "boundary_host" "backend_servers" {
for_each = var.target_ips
type = "static"
name = "backend_server_${each.value}"
description = "Backend server #${each.value}"
address = each.key
host_catalog_id = boundary_host_catalog.backend_servers.id
}
Trying to destroy I receive this error:
boundary/vars.tf
boundary/hosts.tf
Do I need to configure something before
destroy
?