Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #627/a9b9bd13 backport][stable-2] ec2_vol - support changing from volume without IOPS to one with IOPS #640

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- ec2_vol - changing a volume from a type that does not support IOPS (like ``standard``) to a type that does (like ``gp3``) fails (https://github.com/ansible-collections/amazon.aws/issues/626).
4 changes: 2 additions & 2 deletions plugins/modules/ec2_vol.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ def update_volume(module, ec2_conn, volume):

iops_changed = False
target_iops = module.params.get('iops')
original_iops = volume.get('iops')
if target_iops:
original_iops = volume['iops']
if target_iops != original_iops:
iops_changed = True
req_obj['Iops'] = target_iops
Expand All @@ -392,7 +392,7 @@ def update_volume(module, ec2_conn, volume):
# otherwise, the default iops value is applied.
if type_changed and target_type == 'gp3':
if (
(volume['iops'] and (int(volume['iops']) < 3000 or int(volume['iops']) > 16000)) or not volume['iops']
(original_iops and (int(original_iops) < 3000 or int(original_iops) > 16000)) or not original_iops
):
req_obj['Iops'] = 3000
iops_changed = True
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/targets/ec2_vol/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
instance: "{{ test_instance.instance_ids[0] }}"
device_name: /dev/sdh
volume_size: 1
volume_type: gp2
volume_type: standard
name: '{{ resource_prefix }} - sdh'
tags:
"lowercase spaced": 'hello cruel world'
Expand Down Expand Up @@ -316,7 +316,7 @@
instance: "{{ test_instance.instance_ids[0] }}"
device_name: /dev/sdh
volume_size: 1
volume_type: gp2
volume_type: standard
tags:
ResourcePrefix: "{{ resource_prefix }}"
check_mode: true
Expand All @@ -332,7 +332,7 @@
instance: "{{ test_instance.instance_ids[0] }}"
device_name: /dev/sdh
volume_size: 1
volume_type: gp2
volume_type: standard
tags:
ResourcePrefix: "{{ resource_prefix }}"
register: new_vol_attach_result_idem
Expand All @@ -350,7 +350,7 @@
id: "{{ new_vol_attach_result.volume.id }}"
device_name: /dev/sdh
volume_size: 1
volume_type: gp2
volume_type: standard
tags:
"lowercase spaced": 'hello cruel world ❤️'
"Title Case": 'Hello Cruel World ❤️'
Expand All @@ -370,7 +370,7 @@
- "'size' in new_vol_attach_result.volume"
- new_vol_attach_result.volume.size == 1
- "'volume_type' in new_vol_attach_result"
- new_vol_attach_result.volume_type == 'gp2'
- new_vol_attach_result.volume_type == 'standard'
- "'tags' in new_vol_attach_result.volume"
- (new_vol_attach_result.volume.tags | length) == 6
- new_vol_attach_result.volume.tags["lowercase spaced"] == 'hello cruel world ❤️'
Expand Down