Skip to content

Commit b6c249f

Browse files
committed
Fixing lb output conditionals
1 parent ac96edc commit b6c249f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

operations/deployment/terraform/aws/bitovi_main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ module "aws_route53_ecs" {
533533

534534
module "aws_waf_ecs" {
535535
source = "../modules/aws/waf"
536-
count = var.aws_waf_enable && var.aws_ecs_enable ? 1 : 0
536+
count = var.aws_waf_enable && var.aws_ecs_enable && module.aws_ecs[0].load_balancer_arn != "" ? 1 : 0
537537
aws_waf_enable = var.aws_waf_enable
538538
aws_waf_logging_enable = var.aws_waf_logging_enable
539539
aws_waf_log_retention_days = var.aws_waf_log_retention_days

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,15 @@ resource "aws_security_group_rule" "incoming_ecs_lb_ports" {
229229
}
230230

231231
output "load_balancer_dns" {
232-
value = aws_alb.ecs_lb[0].dns_name
232+
value = length(local.aws_ecs_sg_container_port) > 1 ? aws_alb.ecs_lb[0].dns_name : ""
233233
}
234234

235235
output "load_balancer_port" {
236-
value = var.aws_certificate_enabled && length(local.aws_ecs_sg_container_port) > 1 ? aws_alb_listener.lb_listener_ssl[0].port : aws_alb_listener.lb_listener[0].port
236+
value = length(local.aws_ecs_sg_container_port) > 1 ? (var.aws_certificate_enabled ? aws_alb_listener.lb_listener_ssl[0].port : aws_alb_listener.lb_listener[0].port) : ""
237237
}
238238

239239
output "load_balancer_protocol" {
240-
value = var.aws_certificate_enabled && length(local.aws_ecs_sg_container_port) > 1 ? aws_alb_listener.lb_listener_ssl[0].protocol : aws_alb_listener.lb_listener[0].protocol
240+
value = length(local.aws_ecs_sg_container_port) > 1 ? (var.aws_certificate_enabled ? aws_alb_listener.lb_listener_ssl[0].protocol : aws_alb_listener.lb_listener[0].protocol) : ""
241241
}
242242

243243
output "load_balancer_zone_id" {

0 commit comments

Comments
 (0)