Skip to content

Commit f8fc0b0

Browse files
committed
feat: add security groups
1 parent 05e6a22 commit f8fc0b0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

platform/terraform/sg/main.tf

+34
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,39 @@ module "alb_sg" {
2828
ingress_rules = ["http-80-tcp"]
2929
ingress_cidr_blocks = ["0.0.0.0/0"]
3030

31+
egress_rules = ["all-all"]
32+
}
33+
34+
module "rds_sg" {
35+
source = "terraform-aws-modules/security-group/aws"
36+
version = "~> 5.0"
37+
38+
name = "rds-sg"
39+
description = "A RDS security group"
40+
vpc_id = module.vpc.vpc_id
41+
42+
ingress_with_cidr_blocks = [
43+
{
44+
from_port = tonumber(var.rds_port)
45+
to_port = tonumber(var.rds_port)
46+
protocol = "tcp"
47+
cidr_blocks = "0.0.0.0/0"
48+
},
49+
]
50+
51+
egress_rules = ["all-all"]
52+
}
53+
54+
module "ec2_sg" {
55+
source = "terraform-aws-modules/security-group/aws"
56+
version = "~> 5.0"
57+
58+
name = "ec2-sg"
59+
description = "A EC2 security group"
60+
vpc_id = module.vpc.vpc_id
61+
62+
ingress_rules = ["http-80-tcp"]
63+
ingress_cidr_blocks = ["0.0.0.0/0"]
64+
3165
egress_rules = ["all-all"]
3266
}

0 commit comments

Comments
 (0)