-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsg_database.tf
38 lines (33 loc) · 1 KB
/
sg_database.tf
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
resource "aws_security_group" "database" {
name = "database"
description = "Allows database access"
tags {
Name = "database"
Description = "Allows database access"
}
vpc_id = "${module.vpc.vpc_id}"
}
resource "aws_security_group_rule" "database_all_egress" {
type = "egress"
from_port = 0
to_port = 65535
protocol = "all"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = "${aws_security_group.database.id}"
}
resource "aws_security_group_rule" "postgres_tcp" {
type = "ingress"
from_port = 5432
to_port = 5432
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = "${aws_security_group.database.id}"
}
resource "aws_security_group_rule" "mysql_tcp" {
type = "ingress"
from_port = 3306
to_port = 3306
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = "${aws_security_group.database.id}"
}