hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.74k stars 9.1k forks source link

AWS Aurora Blue/Green Update #28956

Closed PackiarajSakkananGW closed 9 months ago

PackiarajSakkananGW commented 1 year ago

Description

blue_green_update is valid only for aws_db_instance and does not work with aws_rds_cluster_instance . As per the documentation aws_rds_cluster_instance is the recommended way to manage aurora instance. If that is the case, blue_green_update should work with Auroa. (aws_rds_cluster_instance)

Affected Resource(s) and/or Data Source(s)

aws_rds_cluster, aws_rds_cluster_instance

Potential Terraform Configuration

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

danielkza commented 1 year ago

Additionally, support for manually managing blue-green deployment resources would be nice, for longer-running validation or more complex scenarios.

cameronattard commented 1 year ago

It would be great to get this prioritised. Major version upgrades with Terraform are currently incredibly painful without this feature.

ribejara-te commented 1 year ago

Yup, big thumbs up to this.

autotune commented 11 months ago

I'm volunteering to work on this issue, this is going to be PR number 7 of my hundred days of Terraform contributions challenge.

autotune commented 11 months ago

I had initially tried to build it in as part of a mapping within the aws_rds_cluster resource, but I think I am going to have to re-work this to be its own resource. Think something like:

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_role_association

resource "aws_rds_cluster_blue_green" "example" { db_cluster_identifier = aws_rds_cluster_instance.example.cluster_identifier enabled = true }

Then we can have a depends_on block to the instances that need to be created first in order for this to work. That's the simplest route to getting this working in a way that makes sense.

I added a new blue_green_clusters.go file and changed everything from DBInstance to DBCluster in the original code and functions/methods and it seems to be working locally. WIP tag to be removed hopefully in the next day or two.

There was no testing available for the map method, creating a new resource so we can actually have tests for this.

autotune commented 11 months ago

@gdavison

This is about 75 percent done, but given RDS Aurora takes 40 minutes or so for a full deployment on each run plus 20 minutes (haven't timed the deletion period yet exactly) or so to delete, it has taken some time to create, read, update, and delete the resource code and test. If you could evaluate what I've got so far once the linter checks are fixed in the second PR noted above that would be great, if you plan to take it over and do your own version/rewrite it would be greatly appreciated if you could let me know.

Priyank-Vaghela commented 10 months ago

I am in the same boat. Big thumbs up to this functionality. This feature would be a significant improvement and prioritizing it would be beneficial, as DB/maintenance upgrades are currently quite challenging without aws_rds_cluster_instance - blue_green_update with Terraform.

gdavison commented 9 months ago

Thank you all for the discussion here.

Unfortunately, Blue/Green Deployments would not work the same with with Aurora clusters as they do with aws_db_instance. With aws_db_instance, they work because it is a single, self-contained resource, so the Blue/Green Deployment can be created, apply its updates, be switched over, and deleted all in one step. Aurora clusters, however, are made up of one aws_rds_cluster and at least one aws_rds_cluster_instance. A Blue/Green Deployment created for one resource would have to complete before the other related resources are updated.

A stand-alone resource for RDS Blue/Green Deployments does not fit with the Terraform model of declarative infrastructure: Using the resource would require multiple iterations of editing the Terraform configuration, applying the configuration, or importing resources. A separate tool that can manage the orchestration steps would be a better fit.

For more details, see https://github.com/hashicorp/terraform-provider-aws/pull/34551

github-actions[bot] commented 8 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.