diff --git a/changelogs/fragments/177-fix-ec2-volume-creation-issue-with-iops.yaml b/changelogs/fragments/177-fix-ec2-volume-creation-issue-with-iops.yaml new file mode 100644 index 00000000000..9c9346e2405 --- /dev/null +++ b/changelogs/fragments/177-fix-ec2-volume-creation-issue-with-iops.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - ec2 - Code fix so module can create ec2 instances with ``ec2_volume_iops`` option (https://github.com/ansible-collections/amazon.aws/pull/177). diff --git a/plugins/modules/ec2.py b/plugins/modules/ec2.py index e9ce5c52022..56aefb0b724 100644 --- a/plugins/modules/ec2.py +++ b/plugins/modules/ec2.py @@ -810,7 +810,7 @@ def create_block_device(module, ec2, volume): if 'iops' in volume: snapshot = ec2.get_all_snapshots(snapshot_ids=[volume['snapshot']])[0] size = volume.get('volume_size', snapshot.volume_size) - if int(volume['iops']) > MAX_IOPS_TO_SIZE_RATIO * size: + if int(volume['iops']) > MAX_IOPS_TO_SIZE_RATIO * int(size): module.fail_json(msg='IOPS must be at most %d times greater than size' % MAX_IOPS_TO_SIZE_RATIO) if 'ephemeral' in volume: if 'snapshot' in volume: