* correctly check that the no_device attribute is specified
 * ignore volume_size requirement if no_device is specified
This commit is contained in:
TJ Tang 2018-03-06 17:39:42 -06:00 committed by Will Thames
parent 2be960f84a
commit 4bb5f40e99

View file

@ -172,6 +172,17 @@ EXAMPLES = '''
iops: 3000
delete_on_termination: true
# create a launch configuration to omit the /dev/sdf EBS device that is included in the AMI image
- ec2_lc:
name: special
image_id: ami-XXX
key_name: default
security_groups: ['group', 'group2' ]
instance_type: t1.micro
volumes:
- device_name: /dev/sdf
no_device: true
'''
RETURN = '''
@ -396,7 +407,7 @@ def create_block_device_meta(module, volume):
if 'device_type' in volume:
volume['volume_type'] = volume.pop('device_type')
if 'snapshot' not in volume and 'ephemeral' not in volume:
if 'snapshot' not in volume and 'ephemeral' not in volume and 'no_device' not in volume:
if 'volume_size' not in volume:
module.fail_json(msg='Size must be specified when creating a new volume or modifying the root volume')
if 'snapshot' in volume:
@ -414,7 +425,7 @@ def create_block_device_meta(module, volume):
if 'device_name' in volume:
return_object['DeviceName'] = volume.get('device_name')
if 'no_device' is volume:
if 'no_device' in volume:
return_object['NoDevice'] = volume.get('no_device')
if any(key in volume for key in ['snapshot', 'volume_size', 'volume_type', 'delete_on_termination', 'ips', 'encrypted']):