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

aws_launch_template add support for Instance Metadata Options #11794

Closed
max-rocket-internet opened this issue Jan 29, 2020 · 7 comments · Fixed by #12491
Closed

aws_launch_template add support for Instance Metadata Options #11794

max-rocket-internet opened this issue Jan 29, 2020 · 7 comments · Fixed by #12491
Assignees
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

@max-rocket-internet
Copy link

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

Currently the aws_launch_template resource does not support Instance Metadata Options. These options can be required when using the Instance Metadata Service Version 2, which new versions of the AWS SDK now use: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html

When calling the CreateLaunchTemplate action in the EC2 API, the LaunchTemplateData object has a MetadataOptions attribute: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_LaunchTemplateInstanceMetadataOptionsRequest.html

New or Affected Resource(s)

  • aws_launch_template

Potential Terraform Configuration

Perhaps in terraform it could look like this:

resource "aws_launch_template" "foo" {
  name = "foo"
  instance_metadata_options {
    http_endpoint               = "enabled"
    http_put_response_hop_limit = 2
    http_tokens                 = "required"
  }
}

References

https://aws.amazon.com/blogs/security/defense-in-depth-open-firewalls-reverse-proxies-ssrf-vulnerabilities-ec2-instance-metadata-service/

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html

https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_LaunchTemplateInstanceMetadataOptionsRequest.html

@max-rocket-internet max-rocket-internet added the enhancement Requests to existing resources that expand the functionality or scope. label Jan 29, 2020
@ghost ghost added the service/ec2 Issues and PRs that pertain to the ec2 service. label Jan 29, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jan 29, 2020
@ewbankkit
Copy link
Contributor

ewbankkit commented Jan 29, 2020

@max-rocket-internet
Copy link
Author

@ewbankkit no that's a different resource, the aws_instance. This resource is for the aws_launch_template which is for instances that are created from an autoscaling group. It's a different AWS API.

@max-rocket-internet
Copy link
Author

If we can't set this setting, then the result for EKS users can be this: https://medium.com/@ngchiwang/aws-eks-pod-role-5e5554fee501

@ewbankkit
Copy link
Contributor

@max-rocket-internet Correct, related but separate.

@bflad
Copy link
Contributor

bflad commented Mar 27, 2020

Support for configuring metadata options in the aws_instance and aws_launch_template resources has been merged and will release with version 2.55.0 of the Terraform AWS Provider, later today. Thanks to @stefansundin and @ewbankkit for the implementation. 👍

@ghost
Copy link

ghost commented Mar 27, 2020

This has been released in version 2.55.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 for triage. Thanks!

@ghost
Copy link

ghost commented Apr 27, 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 27, 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
3 participants