Skip to content

Commit

Permalink
Make sure we don't update tags in check_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Oct 12, 2021
1 parent 77236ee commit 55fc45f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions plugins/module_utils/route53.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ def manage_tags(module, client, resource_type, resource_spec, resource_id):
old_tags, new_tags,
purge_tags=resource_spec['purge_tags'],
)

if not tags_to_set and not tags_to_delete:
return False

if module.check_mode:
return True

# boto3 does not provide create/remove functions for tags in Route 53,
# neither it works with empty values as parameters to change_tags_for_resource,
# so we need to call the change function twice
Expand All @@ -37,6 +44,4 @@ def manage_tags(module, client, resource_type, resource_spec, resource_id):
ResourceId=resource_id,
RemoveTagKeys=tags_to_delete,
)
if tags_to_set or tags_to_delete:
return True
return False
return True

0 comments on commit 55fc45f

Please sign in to comment.