1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Bug fixes for gcp_dns_managed_zone (#42831)

This commit is contained in:
Alex Stephen 2018-08-13 09:09:38 -07:00 committed by Ryan Brown
parent 2a346af18b
commit 7f981b4123
2 changed files with 27 additions and 40 deletions

View file

@ -32,9 +32,8 @@ DOCUMENTATION = '''
--- ---
module: gcp_dns_managed_zone module: gcp_dns_managed_zone
description: description:
- A zone is a subtree of the DNS namespace under one administrative - A zone is a subtree of the DNS namespace under one administrative responsibility.
responsibility. A ManagedZone is a resource that represents a DNS zone A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service.
hosted by the Cloud DNS service.
short_description: Creates a GCP ManagedZone short_description: Creates a GCP ManagedZone
version_added: 2.5 version_added: 2.5
author: Google Inc. (@googlecloudplatform) author: Google Inc. (@googlecloudplatform)
@ -46,14 +45,12 @@ options:
state: state:
description: description:
- Whether the given object should exist in GCP - Whether the given object should exist in GCP
required: true
choices: ['present', 'absent'] choices: ['present', 'absent']
default: 'present' default: 'present'
description: description:
description: description:
- A mutable string of at most 1024 characters associated with this - A mutable string of at most 1024 characters associated with this resource for the
resource for the user's convenience. Has no effect on the managed user's convenience. Has no effect on the managed zone's function.
zone's function.
required: false required: false
dns_name: dns_name:
description: description:
@ -66,9 +63,9 @@ options:
required: true required: true
name_server_set: name_server_set:
description: description:
- Optionally specifies the NameServerSet for this ManagedZone. A - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is
NameServerSet is a set of DNS name servers that all host the same a set of DNS name servers that all host the same ManagedZones. Most users will leave
ManagedZones. Most users will leave this field unset. this field unset.
required: false required: false
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''
@ -76,23 +73,20 @@ extends_documentation_fragment: gcp
EXAMPLES = ''' EXAMPLES = '''
- name: create a managed zone - name: create a managed zone
gcp_dns_managed_zone: gcp_dns_managed_zone:
name: testObject name: "test_object"
dns_name: test.somewild2.example.com. dns_name: test.somewild2.example.com.
description: 'test zone' description: test zone
project: testProject project: "test_project"
auth_kind: service_account auth_kind: "service_account"
service_account_file: /tmp/auth.pem service_account_file: "/tmp/auth.pem"
scopes:
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
state: present state: present
''' '''
RETURN = ''' RETURN = '''
description: description:
description: description:
- A mutable string of at most 1024 characters associated with this - A mutable string of at most 1024 characters associated with this resource for the
resource for the user's convenience. Has no effect on the managed user's convenience. Has no effect on the managed zone's function.
zone's function.
returned: success returned: success
type: str type: str
dns_name: dns_name:
@ -113,15 +107,15 @@ RETURN = '''
type: str type: str
name_servers: name_servers:
description: description:
- Delegate your managed_zone to these virtual name servers; defined - Delegate your managed_zone to these virtual name servers; defined by the server
by the server. .
returned: success returned: success
type: list type: list
name_server_set: name_server_set:
description: description:
- Optionally specifies the NameServerSet for this ManagedZone. A - Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is
NameServerSet is a set of DNS name servers that all host the same a set of DNS name servers that all host the same ManagedZones. Most users will leave
ManagedZones. Most users will leave this field unset. this field unset.
returned: success returned: success
type: list type: list
creation_time: creation_time:
@ -157,6 +151,9 @@ def main():
) )
) )
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/ndev.clouddns.readwrite']
state = module.params['state'] state = module.params['state']
kind = 'dns#managedZone' kind = 'dns#managedZone'

View file

@ -17,24 +17,20 @@
gcp_dns_managed_zone: gcp_dns_managed_zone:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dns_name: test.somewild2.example.com. dns_name: test.somewild2.example.com.
description: 'test zone' description: test zone
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
state: absent state: absent
#---------------------------------------------------------- #----------------------------------------------------------
- name: create a managed zone - name: create a managed zone
gcp_dns_managed_zone: gcp_dns_managed_zone:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dns_name: test.somewild2.example.com. dns_name: test.somewild2.example.com.
description: 'test zone' description: test zone
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
state: present state: present
register: result register: result
- name: assert changed is true - name: assert changed is true
@ -55,12 +51,10 @@
gcp_dns_managed_zone: gcp_dns_managed_zone:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dns_name: test.somewild2.example.com. dns_name: test.somewild2.example.com.
description: 'test zone' description: test zone
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
state: present state: present
register: result register: result
- name: assert changed is false - name: assert changed is false
@ -73,12 +67,10 @@
gcp_dns_managed_zone: gcp_dns_managed_zone:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dns_name: test.somewild2.example.com. dns_name: test.somewild2.example.com.
description: 'test zone' description: test zone
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
state: absent state: absent
register: result register: result
- name: assert changed is true - name: assert changed is true
@ -101,12 +93,10 @@
gcp_dns_managed_zone: gcp_dns_managed_zone:
name: "{{ resource_name }}" name: "{{ resource_name }}"
dns_name: test.somewild2.example.com. dns_name: test.somewild2.example.com.
description: 'test zone' description: test zone
project: "{{ gcp_project }}" project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}" auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}" service_account_file: "{{ gcp_cred_file }}"
scopes:
- https://www.googleapis.com/auth/ndev.clouddns.readwrite
state: absent state: absent
register: result register: result
- name: assert changed is false - name: assert changed is false