diff --git a/changelogs/fragments/202401025-ec2_vol.yml b/changelogs/fragments/202401025-ec2_vol.yml new file mode 100644 index 00000000000..bc014803951 --- /dev/null +++ b/changelogs/fragments/202401025-ec2_vol.yml @@ -0,0 +1,2 @@ +bugfixes: + - ec2_vol - output volume informations when volume exists in check mode (https://github.com/ansible-collections/amazon.aws/pull/2133). diff --git a/plugins/modules/ec2_vol.py b/plugins/modules/ec2_vol.py index 6d0aa09f887..443dd3a2694 100644 --- a/plugins/modules/ec2_vol.py +++ b/plugins/modules/ec2_vol.py @@ -566,7 +566,9 @@ def attach_volume( if attachment_data[0].get("status") in ["attached", "attaching"]: instance_id = attachment_data[0].get("instance_id", "None") module.exit_json( - changed=False, msg=f"IN CHECK MODE - volume already attached to instance: {instance_id}." + changed=False, + msg=f"IN CHECK MODE - volume already attached to instance: {instance_id}.", + volume=volume_dict, ) if not volume_dict["multi_attach_enabled"]: # volumes without MultiAttach Enabled can be attached to 1 instance only