aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclarkzjw <[email protected]>2023-01-31 14:24:47 -0800
committerclarkzjw <[email protected]>2023-01-31 14:24:47 -0800
commit55bf0526c86c88f5ae0d20bad6587c72cd91e835 (patch)
tree286340ac38a8f4558baa985fe6f364a9d8261a63 /infra/sg.tf
parent0d9b8b4a4a2bb936744a338d1e7a42f2bd2272c9 (diff)
downloadzjw.social-55bf0526c86c88f5ae0d20bad6587c72cd91e835.tar.gz
add ec2, rds
Diffstat (limited to 'infra/sg.tf')
-rw-r--r--infra/sg.tf38
1 files changed, 38 insertions, 0 deletions
diff --git a/infra/sg.tf b/infra/sg.tf
new file mode 100644
index 0000000..48d5406
--- /dev/null
+++ b/infra/sg.tf
@@ -0,0 +1,38 @@
1# EC 2
2resource "aws_security_group" "backend" {
3 name = local.name
4 vpc_id = module.vpc.vpc_id
5}
6
7resource "aws_security_group_rule" "backend_ingress_ssh" {
8 security_group_id = aws_security_group.backend.id
9 type = "ingress"
10 protocol = "tcp"
11 from_port = 22
12 to_port = 22
13 cidr_blocks = ["0.0.0.0/0"]
14}
15
16resource "aws_security_group_rule" "backend_egress_all" {
17 security_group_id = aws_security_group.backend.id
18 type = "egress"
19 protocol = "all"
20 from_port = 0
21 to_port = 0
22 cidr_blocks = ["0.0.0.0/0"]
23}
24
25# RDS
26resource "aws_security_group" "rds" {
27 name = "${local.name}-db"
28 vpc_id = module.vpc.vpc_id
29}
30
31resource "aws_security_group_rule" "rds_ingress_backend" {
32 security_group_id = aws_security_group.rds.id
33 type = "ingress"
34 protocol = "tcp"
35 from_port = var.rds_port
36 to_port = var.rds_port
37 source_security_group_id = aws_security_group.backend.id
38}
Powered by cgit v1.2.3 (git 2.41.0)