diff --git a/load_balancer.tf b/load_balancer.tf index 3fa15bc..f14c7c0 100644 --- a/load_balancer.tf +++ b/load_balancer.tf @@ -58,21 +58,21 @@ module "alb" { # HTTPS redirects are enabled only for public facing ALB resource "aws_lb_listener" "allow_http" { - count = var.enable_alb && var.alb_internal ? 0 : 1 - load_balancer_arn = module.alb[0].this_lb_arn + count = (var.enable_alb == true && var.alb_internal == false) ? 1 : 0 + load_balancer_arn = module.alb.this_lb_arn port = "80" protocol = "HTTP" default_action { type = "forward" - target_group_arn = module.alb[0].target_group_arns[0] + target_group_arn = module.alb.target_group_arns[0] } } # Allow non-encrypted traffic for internal ALB onb port 80 resource "aws_lb_listener" "force_https" { - count = var.enable_alb && var.alb_internal ? 1 : 0 - load_balancer_arn = module.alb[0].this_lb_arn + count = (var.enable_alb == true && var.alb_internal == true) ? 1 : 0 + load_balancer_arn = module.alb.this_lb_arn port = "80" protocol = "HTTP"