Skip to content

Commit

Permalink
Merge pull request #23086 from mbatanian/f-aws_rds_instance-restore_b…
Browse files Browse the repository at this point in the history
…ackup

Add `source_db_instance_automated_backup_arn` as point in time restore option for rds_instance
  • Loading branch information
ewbankkit authored Mar 15, 2022
2 parents df37eca + da3a377 commit 3804ad7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/23086.txt
Original file line number Diff line number Diff line change
@@ -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
```
9 changes: 9 additions & 0 deletions internal/service/rds/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
Expand Down
5 changes: 3 additions & 2 deletions website/docs/r/db_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3804ad7

Please sign in to comment.