Skip to content

Commit

Permalink
Skip trying to tag empemeral volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Oct 1, 2021
1 parent 904b525 commit c9d855e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/520-ec2_ami-tagging.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
minor_changes:
- ec2_ami - use module_util helper for tagging AMIs (https://github.com/ansible-collections/amazon.aws/pull/520).
bugfixes:
- ec2_ami - fix problem when creating an AMI from an instance with ephemeral volumes (https://github.com/ansible-collections/amazon.aws/issues/511).
3 changes: 3 additions & 0 deletions plugins/modules/ec2_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ def create_image(module, connection):
add_ec2_tags(connection, module, image_id, tags)
if image_info and image_info.get('BlockDeviceMappings'):
for mapping in image_info.get('BlockDeviceMappings'):
# We can only tag Ebs volumes
if 'Ebs' not in mapping:
continue
add_ec2_tags(connection, module, mapping.get('Ebs').get('SnapshotId'), tags)

if launch_permissions:
Expand Down

0 comments on commit c9d855e

Please sign in to comment.