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

Add support for EC2 Launch Templates #2505

Closed
aggallim opened this issue Dec 1, 2017 · 11 comments
Closed

Add support for EC2 Launch Templates #2505

aggallim opened this issue Dec 1, 2017 · 11 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@aggallim
Copy link

aggallim commented Dec 1, 2017

AWS have announced EC2 Launch Templates. These are to be a 'first class citizen' passing configuration to Autoscaling groups and Spot fleet deployments. This likely to become a long term replacement for launch configurations.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html

@bflad
Copy link
Contributor

bflad commented Dec 5, 2017

For what its worth, it seems these will help resolve the lack of volume tagging provided by the autoscaling group API (#1788).

@danthegoodman
Copy link

Right now, this is the only way to configure an auto scaling group with the T2 Unlimited feature.

@danieladams456
Copy link
Contributor

The use case I would like to use it for would be making patching via immutable AMIs much easier with Terraform. Right now since Launch Configurations are immutable and not versioned, it's a resource change to point an ASG to a new Launch Configuration. Since now ASGs can launch instances based on a default version of a Launch Template, Terraform can create the infrastructure but have CloudWatch events/Lambda orchestration manage the AMI version in a pipeline through the environments.

Thinking through this without knowing how the code works, the ideal situation would seem to be putting a boolean on the Launch Template to tell terraform to manage versions or not. If true, it would create/destroy versions to line up with the code. If false, you could create a first version in Terraform to kickstart your project. It would not be explicitly set as default (so terraform wouldn't try to "correct" it later) but rather just be the implicit default version by being the only one. When you want to patch, you can have your lambda functions copy up the AMI from the lower environment, copy the default version of the launch configuration except for the AMI ID update, save it as a new version, and set the new as default.

As a backup plan if that boolean option wasn't possible, we could use a data provider and manage the launch configuration separately from the main project, but it would be nicer to have all the code in the same place for hooking up security groups, etc.

@apparentlymart
Copy link
Contributor

Hi @aggallim! Thanks for this feature request.

The Terraform team at HashiCorp won't be able to work on this in the very near future due to our focus being elsewhere -- not to mention the impending holiday break -- but we'd be happy to review a pull request if you or someone else has the time and motivation to implement it. Alternatively, if others would also like to see this implemented I'd encourage adding a 👍 upvote reaction to the original issue comment (not to this comment), which we use as one of the inputs to prioritize work for the Terraform team.

@apparentlymart apparentlymart added the enhancement Requests to existing resources that expand the functionality or scope. label Dec 19, 2017
@kl4w
Copy link
Contributor

kl4w commented Jan 10, 2018

I've created a WIP PR but have some questions about how to handle this better.

@radeksimko radeksimko added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 21, 2018
@bflad bflad added this to the v1.15.0 milestone Apr 13, 2018
@bflad
Copy link
Contributor

bflad commented Apr 13, 2018

Shout out to @kl4w! The new aws_launch_template resource will be available in v1.15.0 of the AWS provider, shipping mid next week. 🎉

@bflad bflad closed this as completed Apr 13, 2018
@aggallim
Copy link
Author

Fab work, thanks all!

@bflad
Copy link
Contributor

bflad commented Apr 18, 2018

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

@Cayan
Copy link

Cayan commented Jul 25, 2018

Is there any way to use a launch template with a spot fleet?

@eestolano
Copy link

@Cayan Apparently not yet - I found an open issue for spot fleet support: #4267

@ghost
Copy link

ghost commented Apr 4, 2020

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!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
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/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

No branches or pull requests

9 participants