Skip to content

Commit

Permalink
ec2_vol: preset the name tag of the volume
Browse files Browse the repository at this point in the history
  • Loading branch information
goneri committed Jan 18, 2021
1 parent fba1477 commit 405d450
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
@@ -0,0 +1,3 @@
---
bugfixes:
- ec2_vol - create or update now preserves the existing tags, including Name (https://github.com/ansible-collections/amazon.aws/issues/229)
3 changes: 2 additions & 1 deletion plugins/modules/ec2_vol.py
Expand Up @@ -783,7 +783,8 @@ def main():
else:
volume, changed = create_volume(module, ec2_conn, zone=zone)

tags['Name'] = name
if name:
tags['Name'] = name
final_tags, tags_changed = ensure_tags(module, ec2_conn, volume['volume_id'], 'volume', tags, False)

if detach_vol_flag:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/targets/ec2_vol/tasks/tests.yml
Expand Up @@ -74,6 +74,7 @@
- "'attachment_set' in volume1.volume"
- "'instance_id' in volume1.volume.attachment_set"
- not volume1.volume.attachment_set.instance_id
- not ("Name" in volume1.volume.tags)
- not volume1.volume.encrypted
- volume1.volume.tags.ResourcePrefix == "{{ resource_prefix }}"

Expand Down Expand Up @@ -103,6 +104,7 @@
- volume2.volume_type == 'io1'
- volume2.volume.iops == 101
- volume2.volume.size == 4
- volume2.volume.tags.Name == "{{ resource_prefix }}"
- volume2.volume.encrypted
- volume2.volume.tags.ResourcePrefix == "{{ resource_prefix }}"

Expand Down

0 comments on commit 405d450

Please sign in to comment.