Skip to content

Commit

Permalink
fix: Separate redis security group rules (#13)
Browse files Browse the repository at this point in the history
* separate redis security group rules

* format
  • Loading branch information
elainaRenee authored Feb 14, 2022
1 parent 5d4fd97 commit 71345d6
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions modules/redis/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ resource "aws_elasticache_replication_group" "default" {
resource "aws_security_group" "redis" {
name = "${var.namespace}-elasticache-security-group"
vpc_id = var.vpc_id
}

resource "aws_security_group_rule" "ingress" {
type = "ingress"
protocol = "tcp"
from_port = "6379"
to_port = "6379"
cidr_blocks = var.vpc_subnets_cidr_blocks
security_group_id = aws_security_group.redis.id
}

ingress {
protocol = "tcp"
from_port = "6379"
to_port = "6379"
cidr_blocks = var.vpc_subnets_cidr_blocks
}

egress {
protocol = "tcp"
from_port = "6379"
to_port = "6379"
cidr_blocks = var.vpc_subnets_cidr_blocks
}
resource "aws_security_group_rule" "egress" {
type = "egress"
protocol = "tcp"
from_port = "6379"
to_port = "6379"
cidr_blocks = var.vpc_subnets_cidr_blocks
security_group_id = aws_security_group.redis.id
}

0 comments on commit 71345d6

Please sign in to comment.