Better Docs + runtime verification for Resource Record Set (#369)

Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
The Magician 2019-08-23 16:23:34 -07:00 committed by Alex Stephen
parent fa63f28139
commit 29203ad250
2 changed files with 16 additions and 15 deletions

View file

@ -76,12 +76,9 @@ options:
type: list
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- 'This field represents a link to a ManagedZone resource in GCP. It can be specified
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_dns_managed_zone task and then set this managed_zone field to "{{ name-of-resource
}}"'
- Identifies the managed zone addressed by this request. This must be a dictionary
that contains both a 'name' key and a 'dnsName' key. You can pass in the results
of the gcp_dns_managed_zone module, which will contain both.
required: true
type: dict
extends_documentation_fragment: gcp
@ -137,7 +134,9 @@ target:
type: list
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Identifies the managed zone addressed by this request. This must be a dictionary
that contains both a 'name' key and a 'dnsName' key. You can pass in the results
of the gcp_dns_managed_zone module, which will contain both.
returned: success
type: dict
'''
@ -180,6 +179,9 @@ def main():
fetch = fetch_wrapped_resource(module, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets')
changed = False
if 'dnsName' not in module.params.get('managed_zone') or 'name' not in module.params.get('managed_zone'):
module.fail_json(msg="managed_zone dictionary must contain both the name of the zone and the dns name of the zone")
if fetch:
if state == 'present':
if is_different(module, fetch):
@ -357,7 +359,7 @@ def prefetch_soa_resource(module):
{
'type': 'SOA',
'managed_zone': module.params['managed_zone'],
'name': replace_resource_dict(module.params['managed_zone'], 'dnsName'),
'name': replace_resource_dict(module.params['managed_zone'], 'name'),
'project': module.params['project'],
'scopes': module.params['scopes'],
'service_account_file': module.params['service_account_file'],

View file

@ -44,12 +44,9 @@ requirements:
options:
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- 'This field represents a link to a ManagedZone resource in GCP. It can be specified
in two ways. First, you can place a dictionary with key ''name'' and value of
your resource''s name Alternatively, you can add `register: name-of-resource`
to a gcp_dns_managed_zone task and then set this managed_zone field to "{{ name-of-resource
}}"'
- Identifies the managed zone addressed by this request. This must be a dictionary
that contains both a 'name' key and a 'dnsName' key. You can pass in the results
of the gcp_dns_managed_zone module, which will contain both.
required: true
type: dict
extends_documentation_fragment: gcp
@ -92,7 +89,9 @@ resources:
type: list
managed_zone:
description:
- Identifies the managed zone addressed by this request.
- Identifies the managed zone addressed by this request. This must be a dictionary
that contains both a 'name' key and a 'dnsName' key. You can pass in the results
of the gcp_dns_managed_zone module, which will contain both.
returned: success
type: dict
'''