Changing NodePool from Zone to Location (#182)

<!-- This change is generated by MagicModules. -->
/cc @rambleraptor
This commit is contained in:
The Magician 2019-01-31 09:54:33 -08:00 committed by Alex Stephen
commit 1ec588abb1
5 changed files with 59 additions and 46 deletions

View file

@ -207,23 +207,27 @@ options:
Alternatively, you can add `register: name-of-resource` to a gcp_container_cluster
task and then set this cluster field to "{{ name-of-resource }}"'
required: true
zone:
location:
description:
- The zone where the node pool is deployed.
- The location where the node pool is deployed.
required: true
aliases:
- region
- zone
version_added: 2.8
extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: create a cluster
gcp_container_cluster:
name: cluster-nodepool
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: "cluster-nodepool"
initial_node_count: 4
location: us-central1-a
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: cluster
- name: create a node pool
@ -231,7 +235,7 @@ EXAMPLES = '''
name: my-pool
initial_node_count: 4
cluster: "{{ cluster }}"
zone: us-central1-a
location: us-central1-a
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
@ -415,9 +419,9 @@ cluster:
- The cluster this node pool belongs to.
returned: success
type: str
zone:
location:
description:
- The zone where the node pool is deployed.
- The location where the node pool is deployed.
returned: success
type: str
'''
@ -468,7 +472,7 @@ def main():
),
),
cluster=dict(required=True),
zone=dict(required=True, type='str'),
location=dict(required=True, type='str', aliases=['region', 'zone']),
)
)
@ -551,8 +555,8 @@ def self_link(module):
def collection(module):
res = {'project': module.params['project'], 'zone': module.params['zone'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{cluster}/nodePools".format(**res)
res = {'project': module.params['project'], 'location': module.params['location'], 'cluster': replace_resource_dict(module.params['cluster'], 'name')}
return "https://container.googleapis.com/v1/projects/{project}/zones/{location}/clusters/{cluster}/nodePools".format(**res)
def return_if_object(module, response, allow_not_found=False):