From 96025a4631553cf365b20a537e24704b7237f047 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Wed, 6 Jul 2022 12:39:44 -0700 Subject: [PATCH 1/3] Add replace_triggered_by for lb_https_listeners According to https://github.com/hashicorp/terraform/issues/16065#issuecomment-328648133, the target must be replaced when a listener is replaced --- main.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.tf b/main.tf index 79f90fc..0d23454 100644 --- a/main.tf +++ b/main.tf @@ -232,6 +232,13 @@ resource "aws_lb_listener" "lb_http_listeners" { type = "forward" } } + + dynamic "lifecycle" { + for_each = (lookup(each.value, "type", "") == "" || lookup(each.value, "type", "") == "forward") ? [1] : [] + replace_triggered_by { + target_group_id = aws_lb_target_group.lb_http_tgs[each.key].id + } + } tags = var.tags } From dc8f9c82bd08d0f821cdcce5f955f53f59c282f5 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Mon, 11 Jul 2022 14:59:45 -0700 Subject: [PATCH 2/3] Add lifecycle for lb_https_listeners --- main.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.tf b/main.tf index 0d23454..420d729 100644 --- a/main.tf +++ b/main.tf @@ -289,6 +289,13 @@ resource "aws_lb_listener" "lb_https_listeners" { } } + dynamic "lifecycle" { + for_each = (lookup(each.value, "type", "") == "" || lookup(each.value, "type", "") == "forward") ? [1] : [] + replace_triggered_by { + target_group_id = aws_lb_target_group.lb_https_tgs[each.key].id + } + } + tags = var.tags } From 34f6767071af37a99679d2ae025d08ee35063e64 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Wed, 20 Jul 2022 14:20:07 -0700 Subject: [PATCH 3/3] Update main.tf --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 420d729..440e81b 100644 --- a/main.tf +++ b/main.tf @@ -232,7 +232,7 @@ resource "aws_lb_listener" "lb_http_listeners" { type = "forward" } } - + dynamic "lifecycle" { for_each = (lookup(each.value, "type", "") == "" || lookup(each.value, "type", "") == "forward") ? [1] : [] replace_triggered_by {