File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
operations/deployment/terraform/modules/aws/ecs Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,15 @@ resource "aws_alb_target_group" "lb_targets" {
5858 }
5959}
6060
61- # Redirect all traffic from the ALB to the target group
61+ # Always exists, acts as a safe dependency wrapper
62+ resource "null_resource" "http_redirect_dep" {
63+ triggers = {
64+ id = (
65+ length (aws_alb_listener. http_redirect ) > 0
66+ ) ? aws_alb_listener.http_redirect[0 ].id : " none"
67+ }
68+ }
69+
6270resource "aws_alb_listener" "lb_listener_ssl" {
6371 count = var. aws_certificate_enabled ? length (local. aws_ecs_lb_port ) : 0
6472 load_balancer_arn = aws_alb. ecs_lb . id
@@ -72,7 +80,7 @@ resource "aws_alb_listener" "lb_listener_ssl" {
7280 type = " forward"
7381 }
7482 lifecycle {
75- replace_triggered_by = compact ([ try (aws_alb_listener . http_redirect [ 0 ] . id , null )])
83+ replace_triggered_by = [null_resource . http_redirect_dep . id ]
7684 }
7785}
7886
@@ -86,12 +94,10 @@ resource "aws_alb_listener" "lb_listener" {
8694 type = " forward"
8795 }
8896 lifecycle {
89- replace_triggered_by = compact ([ try (aws_alb_listener . http_redirect [ 0 ] . id , null )])
97+ replace_triggered_by = [null_resource . http_redirect_dep . id ]
9098 }
9199}
92100
93-
94-
95101resource "aws_alb_listener_rule" "redirect_based_on_path" {
96102 for_each = { for idx , path in local . aws_ecs_lb_container_path : idx => path if length (path) > 0 }
97103 listener_arn = var. aws_certificate_enabled ? aws_alb_listener. lb_listener_ssl [0 ]. arn : aws_alb_listener. lb_listener [0 ]. arn
You can’t perform that action at this time.
0 commit comments