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 authored and alinabuzachis committed Sep 26, 2022
1 parent 1755f7a commit 8672035
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 8672035

Please sign in to comment.