Skip to content

Commit

Permalink
Support additional fields for dedicated launch and accept AdditionalI…
Browse files Browse the repository at this point in the history
…nfo parameter.

These parameters are already supported by boto3.
  • Loading branch information
Ubuntu committed Oct 23, 2023
1 parent e7d8a53 commit 57f3d84
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions plugins/modules/ec2_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,16 @@
returned: always
type: str
sample: default
host_id:
description: The ID of the Dedicated Host on which the instance resides.
returned: always
type: str
sample: ""
additional_info:
description: Reserved.
returned: always
type: dict
sample:
private_dns_name:
description: The private DNS name.
returned: always
Expand Down Expand Up @@ -1293,6 +1303,16 @@ def build_top_level_options(params):
spec["Placement"]["GroupName"] = str(params.get("placement_group"))
else:
spec.setdefault("Placement", {"GroupName": str(params.get("placement_group"))})
if params.get("host_id"):
if "Placement" in spec:
spec["Placement"]["HostId"] = str(params.get("host_id"))
else:
spec.setdefault("Placement", {"HostId": str(params.get("host_id"))})
if params.get("availability_zone"):
if "Placement" in spec:
spec["Placement"]["AvailabilityZone"] = str(params.get("availability_zone"))
else:
spec.setdefault("Placement", {"AvailabilityZone": str(params.get("availability_zone"))})
if params.get("ebs_optimized") is not None:
spec["EbsOptimized"] = params.get("ebs_optimized")
if params.get("instance_initiated_shutdown_behavior"):
Expand Down Expand Up @@ -1323,6 +1343,8 @@ def build_top_level_options(params):
)
spec["MetadataOptions"]["HttpProtocolIpv6"] = params.get("metadata_options").get("http_protocol_ipv6")
spec["MetadataOptions"]["InstanceMetadataTags"] = params.get("metadata_options").get("instance_metadata_tags")
if params.get('additional_info'):
spec['AdditionalInfo'] = params.get('additional_info')

return spec

Expand Down Expand Up @@ -2134,6 +2156,8 @@ def main():
instance_metadata_tags=dict(choices=["disabled", "enabled"], default="disabled"),
),
),
additional_info=dict(type='str'),
host_id=dict(type="str"),
)
# running/present are synonyms
# as are terminated/absent
Expand Down

0 comments on commit 57f3d84

Please sign in to comment.