Skip to content

Commit

Permalink
fix: Only call target group attachment when a target_id is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs committed Aug 24, 2023
1 parent 9707518 commit d112a97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ resource "aws_lb_target_group" "this" {
################################################################################

resource "aws_lb_target_group_attachment" "this" {
for_each = { for k, v in var.target_groups : k => v if local.create }
for_each = { for k, v in var.target_groups : k => v if local.create && lookup(v, "target_id", null) != null }

target_group_arn = aws_lb_target_group.this[each.key].arn
target_id = each.value.target_id
Expand Down

0 comments on commit d112a97

Please sign in to comment.