New module GCP DNS Resource Record Set (#35920)

This commit is contained in:
Alex Stephen 2018-04-12 04:31:43 -07:00
commit 35b9d0c43f
7 changed files with 895 additions and 4 deletions

View file

@ -0,0 +1 @@
cloud/gcp

View file

@ -0,0 +1,3 @@
---
# defaults file
resource_name: '{{resource_prefix}}'

View file

@ -0,0 +1,144 @@
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file at
# https://www.github.com/GoogleCloudPlatform/magic-modules
#
# ----------------------------------------------------------------------------
# Pre-test setup
- name: create a managed zone
gcp_dns_managed_zone:
name: 'managedzone-rrs'
dns_name: 'testzone-4.com.'
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: managed_zone
- name: delete a resource record set
gcp_dns_resource_record_set:
name: 'www.testzone-4.com.'
managed_zone: "{{ managed_zone }}"
type: 'A'
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
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 resource record set
gcp_dns_resource_record_set:
name: 'www.testzone-4.com.'
managed_zone: "{{ managed_zone }}"
type: 'A'
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
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
assert:
that:
- result.changed == true
- "result.kind == 'dns#resourceRecordSet'"
# ----------------------------------------------------------------------------
- name: create a resource record set that already exists
gcp_dns_resource_record_set:
name: 'www.testzone-4.com.'
managed_zone: "{{ managed_zone }}"
type: 'A'
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
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
assert:
that:
- result.changed == false
- "result.kind == 'dns#resourceRecordSet'"
#----------------------------------------------------------
- name: delete a resource record set
gcp_dns_resource_record_set:
name: 'www.testzone-4.com.'
managed_zone: "{{ managed_zone }}"
type: 'A'
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
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
assert:
that:
- result.changed == true
- result.has_key('kind') == False
# ----------------------------------------------------------------------------
- name: delete a resource record set that does not exist
gcp_dns_resource_record_set:
name: 'www.testzone-4.com.'
managed_zone: "{{ managed_zone }}"
type: 'A'
ttl: 600
target:
- 10.1.2.3
- 40.5.6.7
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
assert:
that:
- result.changed == false
- result.has_key('kind') == False
#---------------------------------------------------------
# Post-test teardown
- name: delete a managed zone
gcp_dns_managed_zone:
name: 'managedzone-rrs'
dns_name: 'testzone-4.com.'
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: managed_zone