diff --git a/plugins/modules/ec2_vol.py b/plugins/modules/ec2_vol.py index e2e559aa330..36213353206 100644 --- a/plugins/modules/ec2_vol.py +++ b/plugins/modules/ec2_vol.py @@ -819,14 +819,14 @@ def main(): final_tags, tags_changed = ensure_tags(module, ec2_conn, volume['volume_id'], 'volume', tags, module.params.get('purge_tags')) if detach_vol_flag: - volume, changed = detach_volume(module, ec2_conn, volume_dict=volume) + volume, attach_changed = detach_volume(module, ec2_conn, volume_dict=volume) elif inst is not None: - volume, vol_attached = attach_volume(module, ec2_conn, volume_dict=volume, instance_dict=inst, device_name=device_name) + volume, attach_changed = attach_volume(module, ec2_conn, volume_dict=volume, instance_dict=inst, device_name=device_name) # Add device, volume_id and volume_type parameters separately to maintain backward compatibility volume_info = get_volume_info(module, volume, tags=final_tags) - if tags_changed or vol_attached: + if tags_changed or attach_changed: changed = True module.exit_json(changed=changed, volume=volume_info, device=device_name,