aboutsummaryrefslogtreecommitdiff
blob: 48d5406d16fcf16c93c95c17df77b83c10f50632 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# EC 2
resource "aws_security_group" "backend" {
  name   = local.name
  vpc_id = module.vpc.vpc_id
}

resource "aws_security_group_rule" "backend_ingress_ssh" {
  security_group_id = aws_security_group.backend.id
  type              = "ingress"
  protocol          = "tcp"
  from_port         = 22
  to_port           = 22
  cidr_blocks       = ["0.0.0.0/0"]
}

resource "aws_security_group_rule" "backend_egress_all" {
  security_group_id = aws_security_group.backend.id
  type              = "egress"
  protocol          = "all"
  from_port         = 0
  to_port           = 0
  cidr_blocks       = ["0.0.0.0/0"]
}

# RDS
resource "aws_security_group" "rds" {
  name   = "${local.name}-db"
  vpc_id = module.vpc.vpc_id
}

resource "aws_security_group_rule" "rds_ingress_backend" {
  security_group_id        = aws_security_group.rds.id
  type                     = "ingress"
  protocol                 = "tcp"
  from_port                = var.rds_port
  to_port                  = var.rds_port
  source_security_group_id = aws_security_group.backend.id
}
Powered by cgit v1.2.3 (git 2.41.0)