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

View file

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