From 19eecc402f7f2cbb6bb2c50c51cbd420f75b0e9d Mon Sep 17 00:00:00 2001 From: Mykola Mykhalov <4667951+miho120@users.noreply.github.com> Date: Wed, 11 Nov 2020 16:18:41 +0100 Subject: [PATCH] Fix ec2 volume creation issue for io1 with iops (#177) * fix-ansible-ec2-volume-iops-issue --- .../fragments/177-fix-ec2-volume-creation-issue-with-iops.yaml | 3 +++ plugins/modules/ec2.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/177-fix-ec2-volume-creation-issue-with-iops.yaml 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: