Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rds: export db snapshot data to S3 #16181

Closed
aviau opened this issue Nov 13, 2020 · 9 comments · Fixed by #28831
Closed

rds: export db snapshot data to S3 #16181

aviau opened this issue Nov 13, 2020 · 9 comments · Fixed by #28831
Assignees
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/rds Issues and PRs that pertain to the rds service.
Milestone

Comments

@aviau
Copy link
Contributor

aviau commented Nov 13, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

It would be great if the provider allowed for exporting db snapshot data to S3 as documented here:

New or Affected Resource(s)

  • aws_rds_*
@aviau aviau added the enhancement Requests to existing resources that expand the functionality or scope. label Nov 13, 2020
@ghost ghost added the service/rds Issues and PRs that pertain to the rds service. label Nov 13, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 13, 2020
@abhinaysutrakar
Copy link

Hi ,

Do we have any update in which version this enhancement can be available?

@GISTech01
Copy link

Any update on the following?

@debu99
Copy link

debu99 commented Mar 25, 2021

any update

@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 8, 2021
@Felistas
Copy link

Felistas commented Feb 4, 2022

Any update?

@Kristin0
Copy link

any update

@jar-b
Copy link
Member

jar-b commented Oct 25, 2022

Since this aligns with the ExportTask API's a resource could look something like the following (to be paired with the cluster_snapshot resource):

resource "aws_db_export_task" "example" {
  export_task_identifier = "my_snapshot_export"
  source_arn             = "arn:aws:rds:AWS_Region:123456789012:snapshot:snapshot_name"
  s3_bucket_name         = "my_export_bucket"
  iam_role_arn           = "iam_role" # actually an IAM role name
  kms_key_id             = "my_key"
}

API Docs:

@jar-b
Copy link
Member

jar-b commented Jan 5, 2023

Edit: After researching the behavior of these API's, this is a borderline terraform resource candidate due to the absence of a traditional CRUD workflow. Once started, export tasks run until completion or failure and cannot be deleted (only cancelled). There are no Update* or Delete* API's, and no single Get* API (though ListExportTasks returns all tasks). If implemented, the alternative behavior for read, update, and delete would need to be carefully considered.

If the decision is made to move forward, a write-up for this proposed resource is documented below.


Workflow Behavior

The proposed behavior on read, update, and delete is as follows:

  • Read - Use ListExportTasks to page through all tasks until a match is found or the list is exhausted.
    • We have submitted a support case for adding a GetExportTasks API, but have no information on whether this will be added or any potential timing.
  • Update - A change to any required or optional attribute will force replacement (destroy + create).
  • Delete - Destruction of an "in-progress" task will cancel the task and remove from state. Destruction of a completed or failed task will simply remove the resource from state.

API Implementations

service/rds

Export Task

Potential Terraform Features

New Resource: aws_rds_export_task

Rationale: Allow practitioners to manage RDS export tasks.

Potential Terraform Configuration:

resource "aws_rds_export_task" "example" {
  # required attributes
  export_task_identifier = "my_snapshot_export"
  iam_role_arn           = "iam_role" # actually an IAM role name
  kms_key_id             = "my_key"
  s3_bucket_name         = "my_export_bucket"
  source_arn             = "arn:aws:rds:AWS_Region:123456789012:snapshot:snapshot_name"

  # optional attributes
  export_only = ["database.table mytable"]
  s3_prefix   = "my_prefix/my-export-name"
}

Arguments:

  • export_task_identifier - (Required) Unique identifier for the snapshot export task.

  • iam_role_arn - (Required) Amazon Resource Name (ARN) of the IAM role to use for writing to the Amazon S3 bucket.

  • kms_key_id - (Required) ID of the Amazon Web Services KMS key to use to encrypt the snapshot.

  • s3_bucket_name - (Required) Name of the Amazon S3 bucket to export the snapshot to.

  • source_arn - (Required) Amazon Resource Name (ARN) of the snapshot to export.

  • export_only - (Optional) Data to be exported from the snapshot. If this parameter is not provided, all the snapshot data is exported. Valid values are documented in the AWS StartExportTask API documentation.

  • s3_prefix - (Optional) Amazon S3 bucket prefix to use as the file name and path of the exported snapshot.

Attributes:

  • failure_cause - Reason the export failed, if it failed.
  • id - Unique identifier for the snapshot export task (same value as export_task_identifier).
  • percent_progress - Progress of the snapshot export task as a percentage.
  • snapshot_time - Time that the snapshot was created.
  • source_type - Type of source for the export.
  • status - Status of the export task.
  • task_end_time - Time that the snapshot export task completed.
  • task_start_time - Time that the snapshot export task started.
  • warning_message - Warning about the snapshot export task, if any.

@github-actions
Copy link

This functionality has been released in v4.51.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants