# --------------------------------------------------------------------------------------------------------------------- # SECURITY GROUP FOR RDS # --------------------------------------------------------------------------------------------------------------------- resource "aws_security_group" "db-sg" { name = "${var.stack}-db-sg" description = "Access to the RDS instances from the VPC" vpc_id = aws_vpc.main.id ingress { from_port = 3306 to_port = 3306 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } ingress { from_port = 8 to_port = 0 protocol = "icmp" cidr_blocks = [var.vpc_cidr] } egress { from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } tags = { Name = "${var.stack}-db-sg" } }