diff --git a/main.tf b/main.tf index 00b38bf..729cfb7 100644 --- a/main.tf +++ b/main.tf @@ -150,7 +150,13 @@ resource "aws_lb_target_group" "default" { resource "aws_lb_listener" "http_forward" { #bridgecrew:skip=BC_AWS_GENERAL_43 - Skipping Ensure that load balancer is using TLS 1.2. #bridgecrew:skip=BC_AWS_NETWORKING_29 - Skipping Ensure ALB Protocol is HTTPS - count = module.this.enabled && var.http_enabled && var.http_redirect != true ? 1 : 0 + count = ( + module.this.enabled && + var.http_enabled && + var.http_redirect != true && + (var.listener_http_fixed_response != null || var.default_target_group_enabled) + ? 1 : 0 + ) load_balancer_arn = one(aws_lb.default[*].arn) port = var.http_port protocol = "HTTP" @@ -172,7 +178,13 @@ resource "aws_lb_listener" "http_forward" { } resource "aws_lb_listener" "http_redirect" { - count = module.this.enabled && var.http_enabled && var.http_redirect == true ? 1 : 0 + count = ( + module.this.enabled && + var.http_enabled && + var.http_redirect == true && + var.default_target_group_enabled + ? 1 : 0 + ) load_balancer_arn = one(aws_lb.default[*].arn) port = var.http_port protocol = "HTTP" @@ -192,7 +204,12 @@ resource "aws_lb_listener" "http_redirect" { resource "aws_lb_listener" "https" { #bridgecrew:skip=BC_AWS_GENERAL_43 - Skipping Ensure that load balancer is using TLS 1.2. - count = module.this.enabled && var.https_enabled ? 1 : 0 + count = ( + module.this.enabled && + var.https_enabled && + (var.listener_https_fixed_response != null || var.default_target_group_enabled) + ? 1 : 0 + ) load_balancer_arn = one(aws_lb.default[*].arn) port = var.https_port