Remove option_group_name so the RDS upgrade can apply - #153
Merged
Conversation
default:postgres-15 does not exist -- AWS creates default option groups lazily, so naming it failed the apply with OptionGroupNotFoundFault. RDS assigns the family default itself when the attribute is absent.
Contributor
|
Terraform plan in terraform Plan: 0 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:
!~ update in-place
Terraform will perform the following actions:
# aws_db_instance.default will be updated in-place
!~ resource "aws_db_instance" "default" {
!~ engine_version = "13.20" -> "15"
id = "db-WEFHC5MZIA5NX5PBTQZPC2STZQ"
!~ parameter_group_name = "default.postgres13" -> "incubator-prod-postgres15"
tags = {
"Name" = "incubator-prod-database"
"terraform_managed" = "true"
}
# (72 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.✅ Plan applied in Terraform apply (OIDC) #61 |
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.
Fixes the failed apply from #152. Re-opens the work on #150.
What happened
#152 merged and
terraform applyfailed:AWS creates default option groups lazily, exactly as it does default parameter groups.
default:postgres-15does not exist in this account, so naming it fails before RDS does any work.No damage. The call was rejected before anything was modified. The instance is still 13.20,
available, on its original parameter and option groups, with an unchanged endpoint. There was no downtime.aws_db_parameter_group.postgres15was created successfully by that run and is already in state.The change
Remove
option_group_namefromaws_db_instance.defaultrather than pointing it somewhere else.Option groups do nothing for PostgreSQL — no options exist for the
postgresengine — and the attribute isOptional+Computedin the AWS provider. With it absent, Terraform stops proposing changes to it and RDS assigns the postgres-15 family default itself during the major upgrade, creatingdefault:postgres-15lazily at that point. That is the one moment it can be created, which is why it cannot be named up front.The alternative, an
aws_db_option_groupresource withmajor_engine_version = "15", also works but adds a managed resource whose only job is to hold zero options indefinitely.A comment is included above the resource so the attribute does not get reintroduced.
Note for whoever refines #150
The action item "Change
option_group_namefrom"default:postgres-13"to"default:postgres-15"— same family constraint" is incorrect, and is what caused the failed apply. The item should say to remove the attribute. The reasoning it gives for parameter groups (AWS creates defaults lazily) applies identically to option groups, but the ticket draws the opposite conclusion for them.Before merging
Confirm the plan is an in-place update to
aws_db_instance.defaultwith 0 to destroy.skip_final_snapshot = trueanddeletion_protection = falsemean a replace would destroy the shared database.Merging is the deploy:
apply_immediately = true, so the upgrade begins on merge. Expect roughly 10-20 minutes of downtime.Prerequisites remain satisfied — snapshot
incubator-prod-database-pre-pg15, PostGIS updated to 3.4.3 on both ballotnav databases, no replication slots, noreg*columns.