-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.tf
34 lines (31 loc) · 952 Bytes
/
db.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
resource "aws_db_instance" "database" {
allocated_storage = 20
max_allocated_storage = 1000
engine = "postgres"
engine_version = "14"
instance_class = "db.t4g.micro"
db_name = "todo"
username = local.database_username
password = local.database_password
parameter_group_name = "default.postgres14"
skip_final_snapshot = true
vpc_security_group_ids = [aws_security_group.database.id]
publicly_accessible = true
}
resource "aws_security_group" "database" {
name = "todo-database"
description = "Allow inbound Postgres traffic"
ingress {
from_port = 5432
to_port = 5432
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
ipv6_cidr_blocks = ["::/0"]
}
}