-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
New Resource: aws_ebs_snapshot_copy #3086
Conversation
74bc52e
to
db64c72
Compare
Rebased on master and added a commit to fix acceptance tests:
|
aws/resource_aws_copy_snapshot.go
Outdated
req := &ec2.DescribeSnapshotsInput{ | ||
SnapshotIds: []*string{aws.String(id)}, | ||
} | ||
err := conn.WaitUntilSnapshotCompleted(req) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function call can result in an loop if incorrect configurations set. Consider a source_snapshot_id
which is in us-west-2
and a config which sets source_region
to us-east-1
. In this scenario, the snapshot shows as pending via the AWS API for a few minutes (2m40s was observed) at which point the following is returned (I assume until the max retries is reached).
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <requestId>d6c4ece6-eded-4a90-a5dd-204191d8bdc5</requestId>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <snapshotSet>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <item>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <snapshotId>snap-0fb4b3336bc1b1493</snapshotId>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <volumeId>vol-ffffffff</volumeId>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <status>error</status>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <statusMessage>Source snapshot is not found</statusMessage>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <startTime>2018-01-23T00:05:06.000Z</startTime>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <progress>0%</progress>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <ownerId>721355555739</ownerId>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <volumeSize>0</volumeSize>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <description/>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: <encrypted>false</encrypted>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: </item>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: </snapshotSet>
2018-01-22T16:14:56.506-0800 [DEBUG] plugin.terraform-provider-aws: </DescribeSnapshotsResponse>
I suspect this could use some more work. At the ten minute mark:
Error: Error applying plan:
1 error(s) occurred:
* aws_copy_snapshot.region_test: 1 error(s) occurred:
* aws_copy_snapshot.region_test: ResourceNotReady: exceeded wait attempts
8d5caba
to
f252278
Compare
Added documentation and rebased on master. |
f252278
to
8397cc3
Compare
Rebased on master to bring up to date with 1.8 release. |
8397cc3
to
c0307e6
Compare
Rebased on master to bring up to date with 1.9 release.
|
c0307e6
to
937dc96
Compare
Rebased on master to bring up to date with 1.10 release.
|
Thanks so much for working on this! I've been using a custom AMI for ECS with a non-standard Block Device Mapping. I can create the AMI itself through Terraform, but I've been having to manually copy the root device snapshot of the official ECS Optimized AMI, and then pass that snapshot ID to terraform. This will make the process much easier for me! |
937dc96
to
a98c717
Compare
@jantman Glad it is helpful! Rebased on master to bring up to date with 1.12.0 release.
|
Hi all, it would be great to see if the new resource @radeksimko because you've helped label the PR, are you also able to help schedule a review of this addition? |
Used TestAccAWSInstance_multipleRegions as an example: https://github.com/terraform-providers/terraform-provider-aws/blob/2a36215957d15aab4c7260a20742980ba70533cb/aws/resource_aws_instance_test.go#L655
a98c717
to
8250874
Compare
I took another look at the original naming, @jantman In case you've been using I've also rebased on the master branch to resolve conflicts and updated tests so that they are passing again.
|
I took another look at the original naming, aws_copy_snapshot, and I've reasoned that it was not consistent with resources like aws_ami_copy. Thus, I've modified the resource to be aws_ebs_snapshot_copy to conform to aws_<resource>_<action> which I thought matched existing resources better.
8250874
to
7e7dc07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @jwieringa! 🚀 Sorry this wasn't reviewed and merged sooner. 😅
--- PASS: TestAccAWSEbsSnapshotCopy_withRegions (66.01s)
--- PASS: TestAccAWSEbsSnapshotCopy_withDescription (135.70s)
--- PASS: TestAccAWSEbsSnapshotCopy_basic (150.72s)
--- PASS: TestAccAWSEbsSnapshotCopy_withKms (199.33s)
--- | ||
layout: "aws" | ||
page_title: "AWS: aws_ebs_snapshot_copy" | ||
sidebar_current: "docs-aws-resource-ebs-snapshot-copy" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing missing was a link in website/aws.erb
😄 Will fix on merge
@bflad Thank you for the merge and handling the missing link. 🎆 |
This has been released in version 1.40.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Purpose: Add
aws_ebs_snapshot_copy
resourceThe bulk of the code is taken from
resource_aws_ebs_snapshot
. Tests are demonstrating the happy path is working.Example Workflow:
Todos: