route53_zone: return existing zone id in check mode (#56702)

* Returns zone ID for existing zone or `null`
* route53_zone: add module unit tests
* route53_zone: add compatibility with Python 2.6 to the unit tests
* route53_zone: address pycodestyle warning (add blank line)
This commit is contained in:
Yury V. Zaytsev 2019-05-24 12:58:55 +02:00 committed by Abhijeet Kasurde
parent 6ebfe413b0
commit d88d71e4b1
2 changed files with 611 additions and 1 deletions

View file

@ -172,6 +172,7 @@ def create(module, client, matching_zones):
'comment': comment,
'name': zone_in,
'delegation_set_id': delegation_set_id,
'zone_id': None,
}
if private_zone:
@ -287,7 +288,10 @@ def create_or_update_public(module, client, matching_zones, record):
module.fail_json_aws(e, msg="Could not create hosted zone")
changed = True
if not module.check_mode:
if module.check_mode:
if zone_details:
record['zone_id'] = zone_details['Id'].replace('/hostedzone/', '')
else:
record['zone_id'] = zone_details['Id'].replace('/hostedzone/', '')
record['name'] = zone_details['Name']
record['delegation_set_id'] = zone_delegation_set_details.get('Id', '').replace('/delegationset/', '')