diff --git a/plugins/modules/gcp_dns_resource_record_set.py b/plugins/modules/gcp_dns_resource_record_set.py index d74ab7c..dc76816 100644 --- a/plugins/modules/gcp_dns_resource_record_set.py +++ b/plugins/modules/gcp_dns_resource_record_set.py @@ -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'], diff --git a/plugins/modules/gcp_dns_resource_record_set_info.py b/plugins/modules/gcp_dns_resource_record_set_info.py index 869e5f6..9b8bc4d 100644 --- a/plugins/modules/gcp_dns_resource_record_set_info.py +++ b/plugins/modules/gcp_dns_resource_record_set_info.py @@ -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 '''