Skip to content

Commit cd389af

Browse files
committed
bumping conditionals
1 parent dceb071 commit cd389af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

operations/deployment/terraform/modules/aws/ecs/aws_ecs_networking.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ resource "aws_alb_listener" "http_www_redirect" {
228228
}
229229

230230
resource "aws_lb_listener_rule" "http_forward_apex" {
231-
count = var.aws_ecs_lb_www_to_apex_redirect && var.aws_r53_domain_name != "" && !var.aws_certificate_enabled ? 1 : 0
231+
count = var.aws_ecs_lb_www_to_apex_redirect && var.aws_r53_domain_name != "" && !var.aws_certificate_enabled && length(aws_alb_listener.http_www_redirect) > 0 ? 1 : 0
232232
listener_arn = aws_alb_listener.http_www_redirect[0].arn
233233
priority = 20
234234

@@ -245,7 +245,7 @@ resource "aws_lb_listener_rule" "http_forward_apex" {
245245
}
246246

247247
resource "aws_lb_listener_rule" "redirect_www_to_apex" {
248-
count = var.aws_ecs_lb_www_to_apex_redirect && var.aws_r53_domain_name != "" ? 1 : 0
248+
count = var.aws_ecs_lb_www_to_apex_redirect && var.aws_r53_domain_name != "" && (var.aws_certificate_enabled ? length(aws_alb_listener.https_redirect) > 0 : length(aws_alb_listener.http_www_redirect) > 0) ? 1 : 0
249249
listener_arn = var.aws_certificate_enabled ? aws_alb_listener.https_redirect[0].arn : aws_alb_listener.http_www_redirect[0].arn
250250
priority = 10
251251

0 commit comments

Comments
 (0)