From 08f286a06e7c2ee2019ad9a4df48cd1299f521b9 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Mon, 25 Nov 2024 17:28:15 +0000 Subject: [PATCH] Fix service custom host headers * The condition was incorrectly returning true when domain names are empty --- ecs-cluster-infrastructure-service-alb.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecs-cluster-infrastructure-service-alb.tf b/ecs-cluster-infrastructure-service-alb.tf index 9534014..2773322 100644 --- a/ecs-cluster-infrastructure-service-alb.tf +++ b/ecs-cluster-infrastructure-service-alb.tf @@ -190,7 +190,7 @@ resource "aws_alb_listener_rule" "infrastructure_ecs_cluster_service_host_header resource "aws_alb_listener_rule" "infrastructure_ecs_cluster_service_host_header_custom" { for_each = { - for k, service in local.infrastructure_ecs_cluster_services : k => service if service["domain_names"] != null ? length(service["domain_names"]) > 0 : service["container_port"] != 0 + for k, service in local.infrastructure_ecs_cluster_services : k => service if service["domain_names"] != null ? length(service["domain_names"]) > 0 && service["container_port"] != 0 : false } listener_arn = each.value["alb_tls_certificate_arn"] != null ? aws_alb_listener.infrastructure_ecs_cluster_service_https[0].arn : aws_alb_listener.infrastructure_ecs_cluster_service_http[0].arn