> 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.