diff --git a/lib/ansible/modules/cloud/amazon/ec2_lc.py b/lib/ansible/modules/cloud/amazon/ec2_lc.py index 1839f813af..7723717553 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_lc.py +++ b/lib/ansible/modules/cloud/amazon/ec2_lc.py @@ -121,6 +121,11 @@ options: - A list of security group id's with which to associate the ClassicLink VPC instances. required: false 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: - aws - ec2 @@ -189,8 +194,9 @@ def create_launch_config(connection, module): name = module.params.get('name') image_id = module.params.get('image_id') key_name = module.params.get('key_name') + vpc_id = module.params.get('vpc_id') 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: module.fail_json(msg=str(e)) user_data = module.params.get('user_data') @@ -319,7 +325,8 @@ def main(): instance_monitoring=dict(default=False, type='bool'), assign_public_ip=dict(type='bool'), 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') ) )