Skip to content

Commit

Permalink
Merge pull request #15 from DNXLabs/bugfix/sg-rules
Browse files Browse the repository at this point in the history
Fix aws_security_group_rule resources
  • Loading branch information
mcosta1105 authored Mar 6, 2023
2 parents 5a93e8d + 7347725 commit a34c400
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sg-nodes.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ data "aws_security_group" "selected" {
values = ["ecs-${var.cluster_name}-nodes"]
}
}

resource "aws_security_group_rule" "vpc_from_nlb_to_ecs_nodes" {
for_each = try(toset(var.security_groups), [])
description = "From NLB subnet"
type = "ingress"
from_port = 0
to_port = 65535
protocol = "TCP"
security_group_id = data.aws_security_group.selected.id
security_group_id = each.key
cidr_blocks = var.nlb_subnets_cidr
}


resource "aws_security_group_rule" "all_from_nlb_to_ecs_nodes" {
for_each = try(toset(var.security_groups), [])
description = "for NLB"
type = "ingress"
from_port = 0
to_port = 65535
protocol = "TCP"
security_group_id = data.aws_security_group.selected.id
security_group_id = each.key
cidr_blocks = var.security_group_ecs_nodes_inbound_cidrs
}

0 comments on commit a34c400

Please sign in to comment.