AWS AMI resources #2784

Merged
merged 1 commit into from Sep 4, 2015

Conversation

Projects
None yet
3 participants
@apparentlymart
Contributor

apparentlymart commented Jul 19, 2015

Three new resources for the AWS provider to support the three different methods of creating an AMI:

  • aws_ami, using RegisterImage to directly set the various AMI attributes.
  • aws_ami_copy, using CopyImage to duplicate an AMI that is possibly in another region
  • aws_ami_from_instance, using CreateImage to produce an AMI fashioned after an active or stopped EC2 instance that uses an EBS filesystem

Other tasks:

  • Acceptance Tests
  • Documentation
@apparentlymart

This comment has been minimized.

Show comment
Hide comment
@apparentlymart

apparentlymart Aug 30, 2015

Contributor

This now has acceptance tests for the aws_ami_copy and aws_ami_from_instance resources. Exercising aws_ami itself requires the existence of an EBS snapshot and there isn't yet a resource for creating those, so all we have for now is a FIXME comment noting that we should come back and write an acceptance test once an aws_ebs_snapshot resource is implemented.

aws_ami_copy is the one with the most obvious use-case here: taking an AMI in one region and copying it to another.

aws_ami_from_instance is obviously dependent on having an instance in a good state for a snapshot, which is a hard thing for Terraform alone to arrange. It found utility in my prototype described in #2789, though.

aws_ami will find its most obvious purpose once an aws_ebs_snapshot_copy resource is available, as a way to fake copying AMIs from one account to another by copying the snapshots and creating a fresh AMI from them.

Contributor

apparentlymart commented Aug 30, 2015

This now has acceptance tests for the aws_ami_copy and aws_ami_from_instance resources. Exercising aws_ami itself requires the existence of an EBS snapshot and there isn't yet a resource for creating those, so all we have for now is a FIXME comment noting that we should come back and write an acceptance test once an aws_ebs_snapshot resource is implemented.

aws_ami_copy is the one with the most obvious use-case here: taking an AMI in one region and copying it to another.

aws_ami_from_instance is obviously dependent on having an instance in a good state for a snapshot, which is a hard thing for Terraform alone to arrange. It found utility in my prototype described in #2789, though.

aws_ami will find its most obvious purpose once an aws_ebs_snapshot_copy resource is available, as a way to fake copying AMIs from one account to another by copying the snapshots and creating a fresh AMI from them.

Three resources for AWS AMIs.
AWS provides three different ways to create AMIs that each have different
inputs, but once they are complete the same management operations apply.

Thus these three resources each have a different "Create" implementation
but then share the same "Read", "Update" and "Delete" implementations.
@phinze

This comment has been minimized.

Show comment
Hide comment
@phinze

phinze Sep 4, 2015

Member

This looks really great, @apparentlymart!

The 3-resources-with-shared-impl model you chose ends up working out very nicely I think. The fact that you only have to implement different Create methods for each resource makes a lot of sense given the relationship between the three.

Totally understandable that we can't AccTest aws_ami yet. I think this looks good to pull in as-is. Amazing work as usual! 😀

Member

phinze commented Sep 4, 2015

This looks really great, @apparentlymart!

The 3-resources-with-shared-impl model you chose ends up working out very nicely I think. The fact that you only have to implement different Create methods for each resource makes a lot of sense given the relationship between the three.

Totally understandable that we can't AccTest aws_ami yet. I think this looks good to pull in as-is. Amazing work as usual! 😀

phinze added a commit that referenced this pull request Sep 4, 2015

@phinze phinze merged commit 3abf479 into hashicorp:master Sep 4, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@stack72 stack72 referenced this pull request Sep 7, 2015

Closed

Ability to create new AMI #509

@apparentlymart apparentlymart deleted the apparentlymart:aws-images branch Sep 9, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment