tryretool / terraform-retool-modules

MIT License
23 stars 40 forks source link

Added support for RDS version control #19

Open LifeCoder45 opened 1 year ago

LifeCoder45 commented 1 year ago

This is a simple PR that does two thing:

The need for this is due to a few issues caused by the current hardcoded database version (13.7).

I added this module to my project last week, all was well. Today, when running terraform plan ... again, there is now a delta:

Terraform will perform the following actions:

  # module.retool.aws_db_instance.this will be updated in-place
  ~ resource "aws_db_instance" "this" {
      ~ engine_version                        = "13.10" -> "13.7"

In the past days, the DB hit its regularly scheduled maintenance window, and upgraded from 13.7 -> 13.10.

However, RDS does not support downgrades, as seen when attempting to apply:

│ Error: updating RDS DB Instance (retool-rds-instance): operation error RDS: ModifyDBInstance, https response error StatusCode: 400, RequestID: ~, api error InvalidParameterCombination: Cannot upgrade postgres from 13.10 to 13.7

So as the module is now, I only have one option, and that's to login to the AWS UI and disable "Auto minor version upgrade" under Maintenance, which is of course not idempotent, and contrary to Terraform principles.

This PR fixes the issue, by providing some flexibility:

These are very minor changes, validated with:

aws_ecs (feature/rds-version-support) λ terraform validate
Success! The configuration is valid.

If possible, it'd be great to get this merged quickly, so I don't have to use the web UI / my own fork I don't intend to maintain.

Thanks!

jamescarignan commented 8 months ago

This would be very useful, as AWS has seemingly deprecated Postgres 13.7 - launching the infrastructure with this module is currently failing due to that version being unavailable, which is confirmed in the RDS web console. I note that 13.7-compatible Aurora still exists.