Skip to content

Commit

Permalink
Fix ec2_lc failing to create multi-volume configurations (ansible#32163)
Browse files Browse the repository at this point in the history
  • Loading branch information
awkspace authored and willthames committed Oct 26, 2017
1 parent ca71a50 commit 87989b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ansible/modules/cloud/amazon/ec2_lc.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def create_launch_config(connection, module):
classic_link_vpc_id = module.params.get('classic_link_vpc_id')
classic_link_vpc_security_groups = module.params.get('classic_link_vpc_security_groups')

block_device_mapping = {}
block_device_mapping = []

convert_list = ['image_id', 'instance_type', 'instance_type', 'instance_id', 'placement_tenancy', 'key_name', 'kernel_id', 'ramdisk_id', 'spot_price']

Expand All @@ -273,7 +273,7 @@ def create_launch_config(connection, module):
module.fail_json(msg='Device name must be set for volume')
# Minimum volume size is 1GB. We'll use volume size explicitly set to 0 to be a signal not to create this volume
if 'volume_size' not in volume or int(volume['volume_size']) > 0:
block_device_mapping.update(create_block_device_meta(module, volume))
block_device_mapping.append(create_block_device_meta(module, volume))

try:
launch_configs = connection.describe_launch_configurations(LaunchConfigurationNames=[name]).get('LaunchConfigurations')
Expand All @@ -298,7 +298,7 @@ def create_launch_config(connection, module):
launch_config['ClassicLinkVPCSecurityGroups'] = classic_link_vpc_security_groups

if block_device_mapping:
launch_config['BlockDeviceMappings'] = [block_device_mapping]
launch_config['BlockDeviceMappings'] = block_device_mapping

if instance_profile_name is not None:
launch_config['IamInstanceProfile'] = instance_profile_name
Expand Down

0 comments on commit 87989b5

Please sign in to comment.