-
Notifications
You must be signed in to change notification settings - Fork 9.9k
aws_ebs_snapshot_import: init resource
#16373
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
Conversation
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 is a bit funny probably, but to test importing a disk image we need a disk image to import. The image on disk, base64'd, is about 3400 bytes long. Compressing, then base64'ing is much shorter, with the trade-off that we need to decompress and unbase64 on the fly for the test.
dc9796a to
cd6cd2a
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.
Welcome @grahamc 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
8d5c8fe to
64b1c8f
Compare
e8224bb to
beca575
Compare
beca575 to
89e63ef
Compare
89e63ef to
ce70760
Compare
|
Just rebased this on top of master, and with it I added tags to the test case after discovering the previous revision of this PR didn't correctly tag the snapshot. |
ce70760 to
3e5589a
Compare
|
Rebased and re-ran the tests. |
|
can this get some attention ? |
This comment has been minimized.
This comment has been minimized.
aws_ebs_snapshot_import: init resource
|
I heard from a Hashicorp person on Twitter that this PR might get looked at soon. |
DrFaust92
left a comment
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.
Not a maintainer but want to help move this along
also add disappears-acceptance-tests
| return nil | ||
| } | ||
|
|
||
| func importAwsEbsSnapshotWaiter(conn *ec2.EC2, importTaskID string) (*ec2.SnapshotTaskDetail, error) { |
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.
best to move to the internal service package, see https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/contributing/retries-and-waiters.md#resource-attribute-value-waiters
|
|
||
| func TestAccAWSEBSSnapshotImport_basic(t *testing.T) { | ||
| var v ec2.Snapshot | ||
| rName := fmt.Sprintf("tf-acc-ebs-snapshot-import-basic-%s", acctest.RandString(7)) |
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.
lets use the more common rName := acctest.RandomWithPrefix("tf-acc-test")
| Read: resourceAwsEbsSnapshotImportRead, | ||
| Update: resourceAwsEbsSnapshotImportUpdate, | ||
| Delete: resourceAwsEbsSnapshotImportDelete, |
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.
i wonder if these are needed and can use existing snapshot function similar to AMI resources. see resource_aws_ami_copy for instance
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.
I took a look a couple days ago and didn't think that it would be worth it to pursue further. There were enough differences that (IIRC) it wouldn't be drop-in.
|
also add changelog file |
1522f8c to
57667a4
Compare
|
Thanks, @DrFaust92! I've had @cole-h help me out and address your feedback. I also rebased on |
|
|
||
| func testAccAwsEbsSnapshotImportConfigBasic(rName string, t *testing.T) string { | ||
| return fmt.Sprintf(` | ||
| resource "aws_s3_bucket" "images" { |
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.
Lets extract the common part between configs for reuse
| }) | ||
| } | ||
|
|
||
| func TestAccAWSEBSSnapshotImport_tags(t *testing.T) { |
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.
| Type: schema.TypeString, | ||
| Computed: true, | ||
| }, | ||
| "tags": tagsSchema(), |
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.
|
Once again, thanks for your time and review, @DrFaust92! I've fixed your suggestions in a few new commits, and |
577efd5 to
cb8ec76
Compare
|
Rebased to resolve a conflict. |
cd8233b to
4930305
Compare
|
❤️ |
|
🥳 wow, thank you so much Bill! |
|
This functionality has been released in v3.52.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! |
|
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Release note for CHANGELOG:
Output from acceptance testing:
I don't feel incredibly comfortable that the code I wrote is good or totally right, but I gave it my best. I'm not much of a Go programmer, and started with the ebs_snapshot resource. Note I didn't add support for importing, because it seems the data around the import parameters are "Disappeared" once the import task completes.
My use case here is combining aws_ebs_snapshot_import with aws_ami and aws_ami_copy to upload, register, and distribute AMIs to a variety of regions. I use Terraform to support the pruning of images over time.