[cloud] Add vpc_id option for ec2_lc security group lookups by name (#24459)

pull/24697/head
Brandon Davidson 8 years ago committed by Ryan Brown
parent cf4806d29d
commit 0210a1a7dc

@ -121,6 +121,11 @@ options:
- A list of security group id's with which to associate the ClassicLink VPC instances. - A list of security group id's with which to associate the ClassicLink VPC instances.
required: false required: false
version_added: "2.0" version_added: "2.0"
vpc_id:
description:
- VPC ID, used when resolving security group names to IDs.
required: false
version_added: "2.4"
extends_documentation_fragment: extends_documentation_fragment:
- aws - aws
- ec2 - ec2
@ -189,8 +194,9 @@ def create_launch_config(connection, module):
name = module.params.get('name') name = module.params.get('name')
image_id = module.params.get('image_id') image_id = module.params.get('image_id')
key_name = module.params.get('key_name') key_name = module.params.get('key_name')
vpc_id = module.params.get('vpc_id')
try: try:
security_groups = get_ec2_security_group_ids_from_names(module.params.get('security_groups'), ec2_connect(module), vpc_id=None, boto3=False) security_groups = get_ec2_security_group_ids_from_names(module.params.get('security_groups'), ec2_connect(module), vpc_id=vpc_id, boto3=False)
except ValueError as e: except ValueError as e:
module.fail_json(msg=str(e)) module.fail_json(msg=str(e))
user_data = module.params.get('user_data') user_data = module.params.get('user_data')
@ -319,7 +325,8 @@ def main():
instance_monitoring=dict(default=False, type='bool'), instance_monitoring=dict(default=False, type='bool'),
assign_public_ip=dict(type='bool'), assign_public_ip=dict(type='bool'),
classic_link_vpc_security_groups=dict(type='list'), classic_link_vpc_security_groups=dict(type='list'),
classic_link_vpc_id=dict(type='str') classic_link_vpc_id=dict(type='str'),
vpc_id=dict(type='str')
) )
) )

Loading…
Cancel
Save