diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index f9fd45e04f..c2b2e04949 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -329,7 +329,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 12463218cf..51e16a94b4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py index 59efb92c5b..02def517b0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy.py @@ -371,7 +371,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py index 62c1c3fcc7..c620ec05b8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_policy_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py index be3f908884..f33349d0b9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py @@ -486,7 +486,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py index 746448d60c..0c6a4e52d5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_subnetwork_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py index 09aa92e316..ec150e13d4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy.py @@ -354,7 +354,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py index ea39b5241e..b7f56b9c6f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_http_proxy_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py index 725d790bc7..229d81a4d7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy.py @@ -481,7 +481,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py index d579b36412..e68a89728d 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py index 5cecd07362..89afc7701a 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -421,7 +421,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py index 146495f7e8..05332d6a11 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py index 51476c6fa8..0e00b0b15b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy.py @@ -467,7 +467,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py index 4b6bc30312..237ed188bf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py index 0f522f2708..1a4679f713 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy.py @@ -376,7 +376,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py index 2ffcedc028..82c16cc1ab 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index b2c263abf5..2ab6321c15 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -334,7 +334,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index 7d51d39761..cdb5992650 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py index 76f3b61a87..4410306ffa 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -556,7 +556,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py index 5957f67e9f..11116766b7 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . extends_documentation_fragment: gcp diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py index ed644fef38..b01e884e96 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -470,7 +470,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri, 'compute#operation') + op_result = fetch_resource(module, op_uri, 'compute#operation', False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py index 8c805236bd..5ef29369bd 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_facts.py @@ -42,7 +42,7 @@ requirements: options: filters: description: - - A list of filter value pairs. Available filters are listed here U(U(https://cloud.google.com/sdk/gcloud/reference/topic/filters).) + - A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/sdk/gcloud/reference/topic/filters.) - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . region: diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 660aed70ab..36e12dbbd4 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -49,7 +49,7 @@ options: default: present name: description: - - The name of this cluster. The name must be unique within this project and zone, + - The name of this cluster. The name must be unique within this project and location, and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens only. Must start with a letter. Must end with a number or a letter. required: false @@ -254,13 +254,11 @@ options: required: false location: description: - - The list of Google Compute Engine locations in which the cluster's nodes should - be located. - required: false - zone: - description: - - The zone where the cluster is deployed. + - The location where the cluster is deployed. required: true + aliases: + - zone + version_added: 2.8 extends_documentation_fragment: gcp ''' @@ -275,7 +273,7 @@ EXAMPLES = ''' node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "test_project" auth_kind: "serviceaccount" service_account_file: "/tmp/auth.pem" @@ -285,7 +283,7 @@ EXAMPLES = ''' RETURN = ''' name: description: - - The name of this cluster. The name must be unique within this project and zone, + - The name of this cluster. The name must be unique within this project and location, and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens only. Must start with a letter. Must end with a number or a letter. returned: success @@ -508,12 +506,6 @@ subnetwork: - The name of the Google Compute Engine subnetwork to which the cluster is connected. returned: success type: str -location: - description: - - The list of Google Compute Engine locations in which the cluster's nodes should - be located. - returned: success - type: list endpoint: description: - The IP address of this cluster's master endpoint. @@ -567,9 +559,9 @@ expireTime: - The time the cluster will be automatically deleted in RFC3339 text format. returned: success type: str -zone: +location: description: - - The zone where the cluster is deployed. + - The location where the cluster is deployed. returned: success type: str ''' @@ -633,8 +625,7 @@ def main(): ), ), subnetwork=dict(type='str'), - location=dict(type='list', elements='str'), - zone=dict(required=True, type='str'), + location=dict(required=True, type='str', aliases=['zone']), ) ) @@ -696,7 +687,6 @@ def resource_to_request(module): u'clusterIpv4Cidr': module.params.get('cluster_ipv4_cidr'), u'addonsConfig': ClusterAddonsconfig(module.params.get('addons_config', {}), module).to_request(), u'subnetwork': module.params.get('subnetwork'), - u'location': module.params.get('location'), } request = encode_request(request, module) return_vals = {} @@ -713,11 +703,11 @@ def fetch_resource(module, link, allow_not_found=True): def self_link(module): - return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters/{name}".format(**module.params) + return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters/{name}".format(**module.params) def collection(module): - return "https://container.googleapis.com/v1/projects/{project}/zones/{zone}/clusters".format(**module.params) + return "https://container.googleapis.com/v1/projects/{project}/locations/{location}/clusters".format(**module.params) def return_if_object(module, response, allow_not_found=False): @@ -774,7 +764,6 @@ def response_to_hash(module, response): u'clusterIpv4Cidr': response.get(u'clusterIpv4Cidr'), u'addonsConfig': ClusterAddonsconfig(response.get(u'addonsConfig', {}), module).from_response(), u'subnetwork': response.get(u'subnetwork'), - u'location': response.get(u'location'), u'endpoint': response.get(u'endpoint'), u'initialClusterVersion': response.get(u'initialClusterVersion'), u'currentMasterVersion': response.get(u'currentMasterVersion'), @@ -811,7 +800,7 @@ def wait_for_completion(status, op_result, module): while status != 'DONE': raise_if_errors(op_result, ['error', 'errors'], module) time.sleep(1.0) - op_result = fetch_resource(module, op_uri) + op_result = fetch_resource(module, op_uri, False) status = navigate_hash(op_result, ['status']) return op_result diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index 21ab822561..1785c26945 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -23,7 +23,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -39,7 +39,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -51,7 +51,7 @@ - result.changed == true - name: verify that cluster was created gcp_container_cluster_facts: - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -73,7 +73,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -94,7 +94,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -106,7 +106,7 @@ - result.changed == true - name: verify that cluster was deleted gcp_container_cluster_facts: - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -128,7 +128,7 @@ node_config: machine_type: n1-standard-4 disk_size_gb: 500 - zone: us-central1-a + location: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}"