terraform-aws-load-balancer icon indicating copy to clipboard operation
terraform-aws-load-balancer copied to clipboard

Cannot be determined `for_each` in `rules` variable of `alb-listener` module

Open posquit0 opened this issue 3 years ago • 0 comments

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

posquit0 avatar Feb 25 '22 17:02 posquit0