Skip to content

Commit bdbc737

Browse files
committed
Avoid dupe rule creation
1 parent e0f0226 commit bdbc737

File tree

1 file changed

+2
-2
lines changed
  • operations/deployment/terraform/modules/aws/lb

1 file changed

+2
-2
lines changed

operations/deployment/terraform/modules/aws/lb/aws_lb.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ resource "aws_lb_listener_rule" "redirect_www_to_apex" {
250250
}
251251

252252
resource "aws_security_group_rule" "incoming_alb_http" {
253-
count = length(aws_alb_listener.http_redirect) + length(aws_alb_listener.http_forward) + length(aws_alb_listener.http_www_redirect)
253+
count = !contains(local.alb_listen_port_list, 80) ? length(aws_alb_listener.http_redirect) + length(aws_alb_listener.http_forward) + length(aws_alb_listener.http_www_redirect) : 0
254254
type = "ingress"
255255
from_port = 80
256256
to_port = 80
@@ -260,7 +260,7 @@ resource "aws_security_group_rule" "incoming_alb_http" {
260260
}
261261

262262
resource "aws_security_group_rule" "incoming_alb_https" {
263-
count = length(aws_alb_listener.https_redirect)
263+
count = !contains(local.alb_listen_port_list, 443) ? length(aws_alb_listener.https_redirect) : 0
264264
type = "ingress"
265265
from_port = 443
266266
to_port = 443

0 commit comments

Comments
 (0)