terraform-aws-modules / terraform-aws-rds

Terraform module to create AWS RDS resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/rds/aws
Apache License 2.0
890 stars 1.34k forks source link

To restore deleted database from continuous AWS backup plan (PITR) #567

Open grzegorz-kulis opened 1 month ago

grzegorz-kulis commented 1 month ago

Is your request related to a new offering from AWS?

Is this functionality available in the AWS provider for Terraform? Yes

Is your request related to a problem? Please describe.

Right now it is not possible to restore a database using continuous AWS Backup plan (PITR) to restore a deleted database. Currently, no argument is able to provide the support for pointing to continuous recovery point with arn such as arn:aws:backup:eu-west-1:***********:recovery-point:continuous:db-**************-**********

Describe the solution you'd like.

I would like to be able to perform PITR for a deleted database pointing to continuous recovery point in such a way:

  restore_to_point_in_time = {
    restore_time                             = "2024-09-25T10:25:00Z"
    source_continuous_automated_backup_arn = "arn:aws:backup:eu-west-1:***********:recovery-point:continuous:db-**************-**********"
  }

Describe alternatives you've considered.

The only alternative so far is building additional tools that would base on AWS CLI aws backup start-restore-job or AWS SDKs which introduces other issues when it comes to tracking the correct Terraform state which would have to be handled separately.

Additional context

I can imagine that most of things in here are based off restore-db-instance-to-point-in-time which allow working with continuous backups while the feature I am describing is basing off start-restore-job which might at this point make things undoable at this point already.

cl0udf0x commented 1 month ago

@grzegorz-kulis This issue was resolved in version 4.3.0.

https://github.com/terraform-aws-modules/terraform-aws-rds/blob/master/modules/db_instance/main.tf#L114

grzegorz-kulis commented 1 month ago

@cl0udf0x Unfortunately, none of the available fields source_db_instance_automated_backups_arn, source_db_instance_identifier, source_dbi_resource_id are accepting the arn I have mentioned in my initial message which is arn:aws:backup:eu-west-1:***********:recovery-point:continuous:db-**************-**********. If you were to insert it into any of these fields you would get an error while applying terraform plan.

github-actions[bot] commented 1 week ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

grzegorz-kulis commented 1 week ago

Is there any update?