diff --git a/lib/ansible/modules/cloud/amazon/elb_target_group_facts.py b/lib/ansible/modules/cloud/amazon/elb_target_group_facts.py index 77d5b37485..0cf548ea30 100644 --- a/lib/ansible/modules/cloud/amazon/elb_target_group_facts.py +++ b/lib/ansible/modules/cloud/amazon/elb_target_group_facts.py @@ -184,11 +184,8 @@ def get_target_group_attributes(connection, module, target_group_arn): module.fail_json(msg=e.message, exception=traceback.format_exc(), **camel_dict_to_snake_dict(e.response)) # Replace '.' with '_' in attribute key names to make it more Ansibley - for k, v in target_group_attributes.items(): - target_group_attributes[k.replace('.', '_')] = v - del target_group_attributes[k] - - return target_group_attributes + return dict((k.replace('.', '_'), v) + for (k, v) in target_group_attributes.items()) def get_target_group_tags(connection, module, target_group_arn):