Skip to content

Commit

Permalink
Add metadata options support
Browse files Browse the repository at this point in the history
  • Loading branch information
mandar242 committed Jul 22, 2021
1 parent bdcae7a commit d2ae4db
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugins/modules/ec2_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,12 @@ def build_top_level_options(params):
spec['CpuOptions'] = {}
spec['CpuOptions']['ThreadsPerCore'] = params.get('cpu_options').get('threads_per_core')
spec['CpuOptions']['CoreCount'] = params.get('cpu_options').get('core_count')
if params.get('metadata_options'):
spec['MetadataOptions'] = {}
spec['MetadataOptions']['HttpEndpoint'] = params.get(
'metadata_options').get('metadata_accessible')
spec['MetadataOptions']['HttpTokens'] = 'optional' if params.get(
'metadata_options').get('metadata_version') == 'v1 and v2' else 'required'
return spec


Expand Down Expand Up @@ -1737,6 +1743,7 @@ def main():
instance_ids=dict(default=[], type='list', elements='str'),
network=dict(default=None, type='dict'),
volumes=dict(default=None, type='list', elements='dict'),
metadata_options=dict(type='dict', options=dict(metadata_accessible=dict(type='str', choices=['enabled', 'disabled'], default='enabled'), metadata_version=dict(type='str', choices=['v1 and v2', 'v2'], default='v1 and v2'))),
)
# running/present are synonyms
# as are terminated/absent
Expand Down

0 comments on commit d2ae4db

Please sign in to comment.