Skip to content

Commit

Permalink
#635 added redis ports to backend and cache SGs
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbass committed Sep 13, 2024
1 parent 0d2c96b commit d70062c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
47 changes: 46 additions & 1 deletion tofu/modules/data-store/cache/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "aws_security_group" "redis" {
})
}

resource "aws_vpc_security_group_ingress_rule" "ingress" {
resource "aws_vpc_security_group_ingress_rule" "ingress_6379" {
for_each = toset(var.source_security_groups)

security_group_id = aws_security_group.redis.id
Expand All @@ -37,6 +37,21 @@ resource "aws_vpc_security_group_ingress_rule" "ingress" {
})
}

resource "aws_vpc_security_group_ingress_rule" "ingress_6380" {
for_each = toset(var.source_security_groups)

security_group_id = aws_security_group.redis.id
description = "redis(6380) ingress"
from_port = 6380
to_port = 6380
ip_protocol = "tcp"
referenced_security_group_id = each.key

tags = merge(var.tags, {
Name = "${var.name_prefix}-redis"
})
}

resource "aws_vpc_security_group_egress_rule" "egress" {
for_each = toset(var.database_subnet_cidrs)

Expand All @@ -51,3 +66,33 @@ resource "aws_vpc_security_group_egress_rule" "egress" {
Name = "${var.name_prefix}-redis"
})
}

resource "aws_vpc_security_group_egress_rule" "egress_6379" {
for_each = toset(var.source_security_groups)

security_group_id = each.key
description = "redis(6379) egress"
from_port = 6379
to_port = 6379
ip_protocol = "tcp"
referenced_security_group_id = aws_security_group.redis.id

tags = merge(var.tags, {
Name = "${var.name_prefix}-redis"
})
}

resource "aws_vpc_security_group_egress_rule" "egress_6380" {
for_each = toset(var.source_security_groups)

security_group_id = each.key
description = "redis(6380) egress"
from_port = 6380
to_port = 6380
ip_protocol = "tcp"
referenced_security_group_id = aws_security_group.redis.id

tags = merge(var.tags, {
Name = "${var.name_prefix}-redis"
})
}
2 changes: 1 addition & 1 deletion tofu/modules/services/backend-infra/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,4 @@ resource "aws_vpc_security_group_egress_rule" "allow_smtp_to_all" {
to_port = 587
ip_protocol = "tcp"
cidr_ipv4 = "0.0.0.0/0"
}
}

0 comments on commit d70062c

Please sign in to comment.