Skip to content

Commit 99aadad

Browse files
authored
Avoid duplicated security rules (fix #23) (#49)
1 parent ec9235a commit 99aadad

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

main.tf

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,8 @@ resource "aws_security_group_rule" "egress" {
160160
cidr_blocks = ["0.0.0.0/0"]
161161
}
162162

163-
resource "aws_security_group_rule" "ingress_through_http" {
164-
for_each = toset(module.ecs-alb.lb_http_tgs_ports)
165-
security_group_id = aws_security_group.ecs_tasks_sg.id
166-
type = "ingress"
167-
from_port = each.key
168-
to_port = each.key
169-
protocol = "tcp"
170-
source_security_group_id = module.ecs-alb.aws_security_group_lb_access_sg_id
171-
}
172-
173-
resource "aws_security_group_rule" "ingress_through_https" {
174-
for_each = toset(module.ecs-alb.lb_https_tgs_ports)
163+
resource "aws_security_group_rule" "ingress_through_http_and_https" {
164+
for_each = toset(concat(module.ecs-alb.lb_https_tgs_ports, module.ecs-alb.lb_http_tgs_ports))
175165
security_group_id = aws_security_group.ecs_tasks_sg.id
176166
type = "ingress"
177167
from_port = each.key

0 commit comments

Comments
 (0)