From 99fae77375fc95bfc075082c4e81932d67fa5c0c Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush <25692880+danquack@users.noreply.github.com> Date: Sun, 14 Mar 2021 06:08:58 -0400 Subject: [PATCH] add metadata options to ec2 template (#322) * add metadata options to ec2 template --- ec2_launch_template.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/ec2_launch_template.py b/ec2_launch_template.py index 4a35812cfb4..c1ce6d3dcb8 100644 --- a/ec2_launch_template.py +++ b/ec2_launch_template.py @@ -325,6 +325,32 @@ U(http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html#instancedata-add-user-data) documentation on user-data. type: str + metadata_options: + description: + - Configure EC2 Metadata options. + - For more information see the IMDS documentation + U(https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html). + type: dict + version_added: 1.5.0 + suboptions: + http_endpoint: + type: str + description: > + This parameter enables or disables the HTTP metadata endpoint on your instances. + choices: [enabled, disabled] + default: 'enabled' + http_put_response_hop_limit: + type: int + description: > + The desired HTTP PUT response hop limit for instance metadata requests. + The larger the number, the further instance metadata requests can travel. + default: 1 + http_tokens: + type: str + description: > + The state of token usage for your instance metadata requests. + choices: [optional, required] + default: 'optional' ''' EXAMPLES = ''' @@ -636,6 +662,14 @@ def main(): enabled=dict(type='bool') ), ), + metadata_options=dict( + type='dict', + options=dict( + http_endpoint=dict(choices=['enabled', 'disabled'], default='enabled'), + http_put_response_hop_limit=dict(type='int', default=1), + http_tokens=dict(choices=['optional', 'required'], default='optional') + ) + ), network_interfaces=dict( type='list', elements='dict',