Upgrade RDS PostgreSQL from 13 to 15 - #152
Merged
Merged
Conversation
Adds a postgres15 parameter group, enables major version upgrade, and moves the option group to the postgres-15 family. Removes the stale import block, which already ran.
Contributor
|
Terraform plan in terraform Plan: 1 to add, 1 to change, 0 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
!~ update in-place
Terraform will perform the following actions:
# aws_db_instance.default will be updated in-place
!~ resource "aws_db_instance" "default" {
+ allow_major_version_upgrade = true
!~ engine_version = "13.20" -> "15"
id = "db-WEFHC5MZIA5NX5PBTQZPC2STZQ"
!~ option_group_name = "default:postgres-13" -> "default:postgres-15"
!~ parameter_group_name = "default.postgres13" -> "incubator-prod-postgres15"
tags = {
"Name" = "incubator-prod-database"
"terraform_managed" = "true"
}
# (70 unchanged attributes hidden)
}
# aws_db_parameter_group.postgres15 will be created
+ resource "aws_db_parameter_group" "postgres15" {
+ arn = (known after apply)
+ description = "incubator-prod-database, PostgreSQL 15"
+ family = "postgres15"
+ id = (known after apply)
+ name = "incubator-prod-postgres15"
+ name_prefix = (known after apply)
+ region = "us-west-2"
+ skip_destroy = false
+ tags = {
+ "Name" = "incubator-prod-postgres15"
+ "terraform_managed" = "true"
}
+ tags_all = {
+ "Name" = "incubator-prod-postgres15"
+ "managed-by" = "terraform-incubator"
+ "terraform_managed" = "true"
}
}
Plan: 1 to add, 1 to change, 0 to destroy.❌ Error applying plan in Terraform apply (OIDC) #60 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #150.
Upgrades the shared
incubator-prod-databaseinstance from PostgreSQL 13.20 to 15. 13.20 is deprecated and the instance is on paid RDS Extended Support.Changes, all in
terraform/database.tfaws_db_parameter_group.postgres15(family = "postgres15") and pointparameter_group_nameat it. RDS rejects a major upgrade that keeps an old-family group, anddefault.postgres15does not exist in the account — AWS creates default groups lazily, anddefault.postgres13is currently the only one.allow_major_version_upgrade = true. Absent today; the apply fails outright on a major bump without it.engine_version"13.20"→"15". Major only:auto_minor_version_upgrade = trueis already set, so pinning a full minor would guarantee drift the next time AWS patches.option_group_name"default:postgres-13"→"default:postgres-15". Same family constraint.importblock. It was the one-time adoption of the pre-existing instance and has already run.Left deliberately unchanged, per decisions recorded on #150:
engine_lifecycle_supportstaysopen-source-rds-extended-support,apply_immediatelystaystrue, andpassword_encryptionis unset so the engine default (scram-sha-256) applies to roles created after the upgrade.The file's existing wide
=alignment is preserved.terraform fmtwants to reformat this file, but it did so before this branch as well — all six.tffiles in the directory are unformatted atmain. Reformatting is left out of scope so the change stays reviewable.Before merging
Confirm the
terraform-planoutput is an in-place update toaws_db_instance.default. A plan proposing to replace this resource must not be merged —skip_final_snapshot = trueanddeletion_protection = falsemean nothing would stop a destroy of the shared database.Merging is the deploy.
.github/workflows/terraform-apply.yamlrunsterraform applywithauto_approve: trueon every push tomaintouching a.tffile, andapply_immediately = truemeans the upgrade begins on merge rather than deferring to the maintenance window. Expect roughly 10-20 minutes of downtime on this data volume.Prerequisites already completed
backup_retention_period = 4is in effect andincubator-prod-database-pre-pg15exists.ballotnav_db_devandballotnav_db_prodregistered PostGIS 3.0.2 while the instance loads 3.4.3 — an RDS minor patch had replaced the binaries withoutALTER EXTENSION ... UPDATEever being run. PG15 on RDS has no 3.0.2, sopg_upgradewould have failed after taking the instance down. Both databases are now at 3.4.3 with the registered version matching the loaded library. Details in the pre-flight comment on Upgrade shared RDS PostgreSQL from 13 to 15 #150.Pre-flight also confirmed no logical replication slots and no
reg*columns in any database, both of which would have blockedpg_upgrade.After merging
Post-merge verification is tracked on #150 and cannot be done from this branch. The most commonly missed step is
ANALYZEon every database —pg_upgradedoes not carry optimizer statistics across, so query plans will be poor until it runs.