From 108cf7fcb24a5934111ea4aa3267bf833a481319 Mon Sep 17 00:00:00 2001 From: mbatanian Date: Wed, 9 Feb 2022 16:56:54 -0500 Subject: [PATCH 1/2] Add `source_db_instance_automated_backup_arn` as optional source to `restore_to_point_in_time` options --- internal/service/rds/instance.go | 9 +++++++++ website/docs/r/db_instance.html.markdown | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/service/rds/instance.go b/internal/service/rds/instance.go index a4b4c4c20ed6..99ed536cdabd 100644 --- a/internal/service/rds/instance.go +++ b/internal/service/rds/instance.go @@ -400,6 +400,11 @@ func ResourceInstance() *schema.Resource { Optional: true, }, + "source_db_instance_automated_backups_arn": { + Type: schema.TypeString, + Optional: true, + }, + "source_dbi_resource_id": { Type: schema.TypeString, Optional: true, @@ -1992,6 +1997,10 @@ func expandRestoreToPointInTime(l []interface{}) *rds.RestoreDBInstanceToPointIn input.SourceDBInstanceIdentifier = aws.String(v) } + if v, ok := tfMap["source_db_instance_automated_backups_arn"].(string); ok && v != "" { + input.SourceDBInstanceAutomatedBackupsArn = aws.String(v) + } + if v, ok := tfMap["source_dbi_resource_id"].(string); ok && v != "" { input.SourceDbiResourceId = aws.String(v) } diff --git a/website/docs/r/db_instance.html.markdown b/website/docs/r/db_instance.html.markdown index 973204826314..0e310bc43c94 100644 --- a/website/docs/r/db_instance.html.markdown +++ b/website/docs/r/db_instance.html.markdown @@ -225,8 +225,9 @@ This setting does not apply to `aurora-mysql` or `aurora-postgresql` DB engines. The `restore_to_point_in_time` block supports the following arguments: * `restore_time` - (Optional) The date and time to restore from. Value must be a time in Universal Coordinated Time (UTC) format and must be before the latest restorable time for the DB instance. Cannot be specified with `use_latest_restorable_time`. -* `source_db_instance_identifier` - (Optional) The identifier of the source DB instance from which to restore. Must match the identifier of an existing DB instance. Required if `source_dbi_resource_id` is not specified. -* `source_dbi_resource_id` - (Optional) The resource ID of the source DB instance from which to restore. Required if `source_db_instance_identifier` is not specified. +* `source_db_instance_identifier` - (Optional) The identifier of the source DB instance from which to restore. Must match the identifier of an existing DB instance. Required if `source_db_instance_automated_backups_arn` or `source_dbi_resource_id` is not specified. +* `source_db_instance_automated_backups_arn` - (Optional) The ARN of the automated backup from which to restore. Required if `source_db_instance_identifier` or `source_dbi_resource_id` is not specified. +* `source_dbi_resource_id` - (Optional) The resource ID of the source DB instance from which to restore. Required if `source_db_instance_identifier` or `source_db_instance_automated_backups_arn` is not specified. * `use_latest_restorable_time` - (Optional) A boolean value that indicates whether the DB instance is restored from the latest backup time. Defaults to `false`. Cannot be specified with `restore_time`. ### S3 Import Options From da3a3775b2f460a66a5b79f0ec013481969fd00c Mon Sep 17 00:00:00 2001 From: mbatanian Date: Wed, 9 Feb 2022 17:26:01 -0500 Subject: [PATCH 2/2] Add changelog --- .changelog/23086.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/23086.txt diff --git a/.changelog/23086.txt b/.changelog/23086.txt new file mode 100644 index 000000000000..02536e26bfd9 --- /dev/null +++ b/.changelog/23086.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_rds_instance: Add `source_db_instance_automated_backup_arn` option within `restore_to_point_in_time` attribute +```