terraform-aws-load-balancer
terraform-aws-load-balancer copied to clipboard
Cannot be determined `for_each` in `rules` variable of `alb-listener` module
> tf apply
â•·
│ Error: Invalid for_each argument
│
│ on ../../modules/alb-listener/main.tf line 148, in resource "aws_lb_listener_rule" "this":
│ 148: for_each = {
│ 149: for rule in var.rules :
│ 150: rule.priority => rule
│ 151: }
│ ├────────────────
│ │ var.rules will be known only after apply
│
│ 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.