cloudposse / terraform-aws-rds-cluster

Terraform module to provision an RDS Aurora cluster for MySQL or Postgres
https://cloudposse.com/accelerate
Apache License 2.0
144 stars 172 forks source link

Allow explicitly naming parameter group, so that Blue Green upgrades can be done across major versions #225

Open philomory opened 2 months ago

philomory commented 2 months ago

Describe the Feature

We would like to be able to explicitly specify the names of the parameter groups created by this module

Expected Behavior

We need to be able to explicitly set the name of the parameter groups created by this module.

Use Case

We are performing a Blue/Green upgrade on our Aurora MySQL database, moving from MySQL 5.7-compatible Aurora to MySQL 8.x-compatible Aurora. To do so, we had to create a new 8.x-compatible parameter group to attach to the green cluster and instances. Since the two parameter groups need to exist concurrently, the new parameter group must have a different name than the original one.

Once we have completed the Blue/Green upgrade, however, if we use terraform state rm to remove the old parameter group from state, and terraform state import to add the new one in its place, the module forces a replacement because the name is incorrect.

Describe Ideal Solution

The ideal solution would be to be able to explicitly specify the name of the parameter group, overriding the module's calculated name.

Alternatives Considered

We basically have two alternatives:

  1. We can create a fork of the module that allows us to explicitly set the parameter group name.
  2. After completing the Blue/Green upgrade, we can remove the original blue parameter group, and then allow terraform to perform a replacement of the new parameter group, creating a new one matching the original naming scheme. Of course, syncing a new parameter group forced a cluster reboot, generating downtime, which somewhat defeats (part of) the purpose of doing a Blue/Green upgrade to begin with.

Additional Context

No response

nitrocode commented 2 months ago

Makes sense to me. I think all names should be overridable when it comes to upgrades and migrating existing resources to terraform modules

There are two parameter groups so each would need its own input

https://github.com/cloudposse/terraform-aws-rds-cluster/blob/69eed44312de811bcfb019542ce611f622d195b3/main.tf#L326-L330

https://github.com/cloudposse/terraform-aws-rds-cluster/blob/69eed44312de811bcfb019542ce611f622d195b3/main.tf#L351-L355

Have you considered putting in a pr?