ec2_instance fix name idempotency (#55224)

This commit is contained in:
James E. King III 2019-05-08 05:07:19 -04:00 committed by John R Barker
parent 57e0567310
commit 1462fd740b
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ec2_instance - make Name tag idempotent (https://github.com/ansible/ansible/pull/55224)

View file

@ -1680,7 +1680,11 @@ def main():
for match in existing_matches:
warn_if_public_ip_assignment_changed(match)
warn_if_cpu_options_changed(match)
changed |= manage_tags(match, (module.params.get('tags') or {}), module.params.get('purge_tags', False), ec2)
tags = module.params.get('tags') or {}
name = module.params.get('name')
if name:
tags['Name'] = name
changed |= manage_tags(match, tags, module.params.get('purge_tags', False), ec2)
if state in ('present', 'running', 'started'):
ensure_present(existing_matches=existing_matches, changed=changed, ec2=ec2, state=state)