Skip to content

Commit 729e63d

Browse files
committedJan 6, 2025
Upgrade infra to PostgreSQL 16
1 parent 72a694e commit 729e63d

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed
 

‎infra/database.tf

+23-6
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,35 @@ resource "aws_db_subnet_group" "this" {
3434
subnet_ids = aws_subnet.private[*].id
3535
}
3636

37+
resource "aws_db_parameter_group" "this" {
38+
name = var.name_prefix
39+
family = "postgres16"
40+
41+
parameter {
42+
name = "rds.force_ssl"
43+
value = "0"
44+
}
45+
46+
lifecycle {
47+
create_before_destroy = true
48+
}
49+
}
50+
3751
resource "aws_db_instance" "this" {
3852
identifier = var.name_prefix
3953
allocated_storage = 20
4054
storage_type = "gp2"
4155
instance_class = "db.t3.medium"
4256

43-
engine = "postgres"
44-
engine_version = "12.14"
45-
auto_minor_version_upgrade = true
46-
db_name = var.db_name
47-
username = var.db_username
48-
password = var.db_password
57+
engine = "postgres"
58+
engine_version = "16.3"
59+
auto_minor_version_upgrade = true
60+
db_name = var.db_name
61+
username = var.db_username
62+
password = var.db_password
63+
parameter_group_name = aws_db_parameter_group.this.name
64+
allow_major_version_upgrade = true
65+
apply_immediately = true
4966

5067
availability_zone = var.availability_zones[0]
5168
db_subnet_group_name = aws_db_subnet_group.this.name

0 commit comments

Comments
 (0)