From d6781a2a5a3b1f35d32bbf5749d4d95fd017d6fe Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 1 Oct 2019 15:27:51 -0700 Subject: [PATCH] Bug fixes for GCP modules (#61590) --- .../gcp_compute_target_https_proxy_info.py | 51 +++- .../cloud/google/gcp_compute_target_pool.py | 50 +++- .../google/gcp_compute_target_pool_info.py | 51 +++- .../google/gcp_compute_target_ssl_proxy.py | 52 +++- .../gcp_compute_target_ssl_proxy_info.py | 51 +++- .../google/gcp_compute_target_tcp_proxy.py | 50 +++- .../gcp_compute_target_tcp_proxy_info.py | 51 +++- .../google/gcp_compute_target_vpn_gateway.py | 50 +++- .../gcp_compute_target_vpn_gateway_info.py | 51 +++- .../cloud/google/gcp_compute_url_map.py | 40 ++- .../cloud/google/gcp_compute_url_map_info.py | 51 +++- .../cloud/google/gcp_compute_vpn_tunnel.py | 56 +++- .../google/gcp_compute_vpn_tunnel_info.py | 57 +++- .../cloud/google/gcp_container_cluster.py | 76 +++-- .../google/gcp_container_cluster_info.py | 53 +++- .../cloud/google/gcp_container_node_pool.py | 56 +++- .../google/gcp_container_node_pool_info.py | 53 +++- .../cloud/google/gcp_dns_managed_zone.py | 58 +++- .../cloud/google/gcp_dns_managed_zone_info.py | 51 +++- .../google/gcp_dns_resource_record_set.py | 45 ++- .../gcp_dns_resource_record_set_info.py | 51 +++- .../cloud/google/gcp_filestore_instance.py | 56 +++- .../google/gcp_filestore_instance_info.py | 54 +++- .../gcp_compute_target_pool/tasks/autogen.yml | 109 +++++++ .../gcp_compute_target_pool/tasks/main.yml | 109 +------ .../tasks/autogen.yml | 266 ++++++++++++++++++ .../tasks/main.yml | 266 +----------------- .../tasks/autogen.yml | 194 +++++++++++++ .../tasks/main.yml | 194 +------------ .../tasks/autogen.yml | 153 ++++++++++ .../tasks/main.yml | 153 +--------- .../gcp_compute_url_map/tasks/autogen.yml | 181 ++++++++++++ .../gcp_compute_url_map/tasks/main.yml | 181 +----------- .../gcp_compute_vpn_tunnel/tasks/autogen.yml | 202 +++++++++++++ .../gcp_compute_vpn_tunnel/tasks/main.yml | 202 +------------ .../gcp_container_cluster/tasks/autogen.yml | 140 +++++++++ .../gcp_container_cluster/tasks/main.yml | 140 +-------- .../gcp_container_node_pool/tasks/autogen.yml | 141 ++++++++++ .../gcp_container_node_pool/tasks/main.yml | 141 +--------- .../gcp_dns_managed_zone/tasks/autogen.yml | 110 ++++++++ .../gcp_dns_managed_zone/tasks/main.yml | 110 +------- .../tasks/autogen.yml | 154 ++++++++++ .../tasks/main.yml | 154 +--------- .../gcp_filestore_instance/tasks/autogen.yml | 145 ++++++++++ .../gcp_filestore_instance/tasks/main.yml | 145 +--------- 45 files changed, 2936 insertions(+), 1868 deletions(-) create mode 100644 test/integration/targets/gcp_compute_target_pool/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_compute_url_map/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_container_cluster/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_container_node_pool/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml create mode 100644 test/integration/targets/gcp_filestore_instance/tasks/autogen.yml diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_info.py b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_info.py index 80ff74e8ed..634175c85b 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_https_proxy_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_compute_target_https_proxy_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP TargetHttpsProxy -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -48,7 +48,54 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' 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 366d50bfd3..417fbde9b2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool.py @@ -33,7 +33,7 @@ module: gcp_compute_target_pool description: - Represents a TargetPool resource, used for Load Balancing. short_description: Creates a GCP TargetPool -version_added: 2.6 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -133,10 +133,56 @@ options: - The region where the target pool resides. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetPools)' - 'Official Documentation: U(https://cloud.google.com/compute/docs/load-balancing/network/target-pools)' +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_info.py b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_info.py index 6db2ec75ea..d74771b299 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_pool_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_pool_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_compute_target_pool_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP TargetPool -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -53,7 +53,54 @@ options: - The region where the target pool resides. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' 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 ce0367ca49..46c086d7b3 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 @@ -34,7 +34,7 @@ description: - Represents a TargetSslProxy resource, which is used by one or more global forwarding rule to route incoming SSL requests to a backend service. short_description: Creates a GCP TargetSslProxy -version_added: 2.6 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -100,11 +100,57 @@ options: }}"' required: false type: dict - version_added: 2.8 -extends_documentation_fragment: gcp + version_added: '2.8' + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/targetSslProxies)' - 'Setting Up SSL proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/)' +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_info.py b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_info.py index 607bed6569..b05299c243 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_ssl_proxy_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_compute_target_ssl_proxy_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP TargetSslProxy -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -48,7 +48,54 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' 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 2ed892406b..e8b7a15534 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 @@ -34,7 +34,7 @@ description: - Represents a TargetTcpProxy resource, which is used by one or more global forwarding rule to route incoming TCP requests to a Backend service. short_description: Creates a GCP TargetTcpProxy -version_added: 2.6 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -81,10 +81,56 @@ options: field to "{{ name-of-resource }}"' required: true type: dict -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/compute/docs/reference/v1/targetTcpProxies)' - 'Setting Up TCP proxy for Google Cloud Load Balancing: U(https://cloud.google.com/compute/docs/load-balancing/tcp-ssl/tcp-proxy)' +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_info.py b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_info.py index 80feecb6c3..73255bc393 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_tcp_proxy_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_compute_target_tcp_proxy_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP TargetTcpProxy -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -48,7 +48,54 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' 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 7d039757e7..efbdee9828 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 @@ -34,7 +34,7 @@ description: - Represents a VPN gateway running in GCP. This virtual device is managed by Google, but used only by you. short_description: Creates a GCP TargetVpnGateway -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -79,9 +79,55 @@ options: - The region this gateway should sit in. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/targetVpnGateways)' +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_info.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_info.py index 8b94e9332b..3279e9e9f5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_compute_target_vpn_gateway_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP TargetVpnGateway -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -53,7 +53,54 @@ options: - The region this gateway should sit in. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' 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 5b4895f067..1792cbdf81 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map.py @@ -34,7 +34,7 @@ description: - UrlMaps are used to route requests to a backend service based on rules that you define for the host and path of an incoming URL. short_description: Creates a GCP UrlMap -version_added: 2.6 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -184,7 +184,43 @@ options: service field to "{{ name-of-resource }}"' required: true type: dict -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_compute_url_map_info.py b/lib/ansible/modules/cloud/google/gcp_compute_url_map_info.py index 0b8bcdb231..66194d70cf 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_url_map_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_url_map_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_compute_url_map_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP UrlMap -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -48,7 +48,54 @@ options: - Each additional filter in the list will act be added as an AND condition (filter1 and filter2) . type: list -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' 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 7efe468020..a859e4f353 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel.py @@ -33,7 +33,7 @@ module: gcp_compute_vpn_tunnel description: - VPN tunnel resource. short_description: Creates a GCP VpnTunnel -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -121,11 +121,57 @@ options: - The region where the tunnel is located. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/vpnTunnels)' - 'Cloud VPN Overview: U(https://cloud.google.com/vpn/docs/concepts/overview)' - 'Networks and Tunnel Routing: U(https://cloud.google.com/vpn/docs/concepts/choosing-networks-routing)' +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' @@ -182,6 +228,11 @@ EXAMPLES = ''' ''' RETURN = ''' +id: + description: + - The unique identifier for the resource. This identifier is defined by the server. + returned: success + type: str creationTimestamp: description: - Creation timestamp in RFC3339 text format. @@ -411,6 +462,7 @@ def is_different(module, response): # This is for doing comparisons with Ansible's current parameters. def response_to_hash(module, response): return { + u'id': response.get(u'id'), u'creationTimestamp': response.get(u'creationTimestamp'), u'name': response.get(u'name'), u'description': module.params.get('description'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_info.py b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_info.py index f88cc106ca..7c618ef0d2 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_vpn_tunnel_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_compute_vpn_tunnel_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP VpnTunnel -version_added: 2.7 +version_added: '2.7' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -53,7 +53,54 @@ options: - The region where the tunnel is located. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' @@ -73,6 +120,12 @@ resources: returned: always type: complex contains: + id: + description: + - The unique identifier for the resource. This identifier is defined by the + server. + returned: success + type: str creationTimestamp: description: - Creation timestamp in RFC3339 text format. diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster.py b/lib/ansible/modules/cloud/google/gcp_container_cluster.py index 8a5130b103..b89962306a 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster.py @@ -33,7 +33,7 @@ module: gcp_container_cluster description: - A Google Container Engine cluster. short_description: Creates a GCP Cluster -version_added: 2.6 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -176,7 +176,7 @@ options: for more information about support for GPUs. required: false type: list - version_added: 2.9 + version_added: '2.9' suboptions: accelerator_count: description: @@ -194,14 +194,14 @@ options: If unspecified, the default disk type is 'pd-standard' . required: false type: str - version_added: 2.9 + version_added: '2.9' min_cpu_platform: description: - Minimum CPU platform to be used by this instance. The instance may be scheduled on the specified or newer CPU platform. required: false type: str - version_added: 2.9 + version_added: '2.9' taints: description: - List of kubernetes taints to be applied to each node. @@ -209,7 +209,7 @@ options: .' required: false type: list - version_added: 2.9 + version_added: '2.9' suboptions: key: description: @@ -253,7 +253,7 @@ options: is issued. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: issue_client_certificate: description: @@ -290,7 +290,7 @@ options: - Configuration for a private cluster. required: false type: dict - version_added: 2.8 + version_added: '2.8' suboptions: enable_private_nodes: description: @@ -361,7 +361,7 @@ options: for the nodes. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: disabled: description: @@ -381,20 +381,20 @@ options: type: list aliases: - nodeLocations - version_added: 2.9 + version_added: '2.9' resource_labels: description: - The resource labels for the cluster to use to annotate any related Google Compute Engine resources. required: false type: dict - version_added: 2.9 + version_added: '2.9' legacy_abac: description: - Configuration for the legacy ABAC authorization mode. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: enabled: description: @@ -409,7 +409,7 @@ options: - Configuration options for the NetworkPolicy feature. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: provider: description: @@ -429,7 +429,7 @@ options: - Only honored if cluster created with IP Alias support. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: max_pods_per_node: description: @@ -441,7 +441,7 @@ options: - Configuration for controlling how IPs are allocated in the cluster. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: use_ip_aliases: description: @@ -515,13 +515,13 @@ options: - Enable the ability to use Cloud TPUs in this cluster. required: false type: bool - version_added: 2.9 + version_added: '2.9' tpu_ipv4_cidr_block: description: - The IP address range of the Cloud TPUs in this cluster, in CIDR notation. required: false type: str - version_added: 2.9 + version_added: '2.9' master_authorized_networks_config: description: - Configuration for controlling how IPs are allocated in the cluster. @@ -558,7 +558,7 @@ options: type: str aliases: - zone - version_added: 2.8 + version_added: '2.8' kubectl_path: description: - The path that the kubectl config file will be written to. @@ -567,15 +567,51 @@ options: - This requires the PyYaml library. required: false type: str - version_added: 2.9 + version_added: '2.9' kubectl_context: description: - The name of the context for the kubectl config file. Will default to the cluster name. required: false type: str - version_added: 2.9 -extends_documentation_fragment: gcp + version_added: '2.9' + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_cluster_info.py b/lib/ansible/modules/cloud/google/gcp_container_cluster_info.py index 772d48a4b9..d11428aa4d 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_cluster_info.py +++ b/lib/ansible/modules/cloud/google/gcp_container_cluster_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_container_cluster_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP Cluster -version_added: 2.8 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -50,8 +50,55 @@ options: aliases: - region - zone - version_added: 2.8 -extends_documentation_fragment: gcp + version_added: '2.8' + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py index 25dbe24aaf..76f6f456fb 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool.py @@ -37,7 +37,7 @@ description: applied to them, which may be used to reference them during pod scheduling. They may also be resized up or down, to accommodate the workload. short_description: Creates a GCP NodePool -version_added: 2.6 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -155,7 +155,7 @@ options: - A list of hardware accelerators to be attached to each node. required: false type: list - version_added: 2.9 + version_added: '2.9' suboptions: accelerator_count: description: @@ -173,20 +173,20 @@ options: If unspecified, the default disk type is 'pd-standard' . required: false type: str - version_added: 2.9 + version_added: '2.9' min_cpu_platform: description: - Minimum CPU platform to be used by this instance. The instance may be scheduled on the specified or newer CPU platform . required: false type: str - version_added: 2.9 + version_added: '2.9' taints: description: - List of kubernetes taints to be applied to each node. required: false type: list - version_added: 2.9 + version_added: '2.9' suboptions: key: description: @@ -215,7 +215,7 @@ options: - The version of the Kubernetes of this node. required: false type: str - version_added: 2.8 + version_added: '2.8' autoscaling: description: - Autoscaler configuration for this NodePool. Autoscaler is enabled only if a @@ -272,7 +272,7 @@ options: on a node in the node pool. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: max_pods_per_node: description: @@ -284,7 +284,7 @@ options: - Which conditions caused the current node pool state. required: false type: list - version_added: 2.9 + version_added: '2.9' suboptions: code: description: @@ -311,8 +311,44 @@ options: aliases: - region - zone - version_added: 2.8 -extends_documentation_fragment: gcp + version_added: '2.8' + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_container_node_pool_info.py b/lib/ansible/modules/cloud/google/gcp_container_node_pool_info.py index 7ca68117d0..51d6574927 100644 --- a/lib/ansible/modules/cloud/google/gcp_container_node_pool_info.py +++ b/lib/ansible/modules/cloud/google/gcp_container_node_pool_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_container_node_pool_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP NodePool -version_added: 2.8 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -50,7 +50,7 @@ options: aliases: - region - zone - version_added: 2.8 + version_added: '2.8' cluster: description: - The cluster this node pool belongs to. @@ -61,7 +61,54 @@ options: }}"' required: true type: dict -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py index 795302b0cb..087bf711a7 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone.py @@ -34,7 +34,7 @@ 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. short_description: Creates a GCP ManagedZone -version_added: 2.5 +version_added: '2.5' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -65,7 +65,7 @@ options: - DNSSEC configuration. required: false type: dict - version_added: 2.9 + version_added: '2.9' suboptions: kind: description: @@ -140,7 +140,7 @@ options: - A set of key/value label pairs to assign to this ManagedZone. required: false type: dict - version_added: 2.8 + version_added: '2.8' visibility: description: - 'The zone''s visibility: public zones are exposed to the Internet, while private @@ -150,14 +150,14 @@ options: required: false default: public type: str - version_added: 2.8 + version_added: '2.8' private_visibility_config: description: - For privately visible zones, the set of Virtual Private Cloud resources that the zone is visible from. required: false type: dict - version_added: 2.8 + version_added: '2.8' suboptions: networks: description: @@ -172,10 +172,56 @@ options: . required: false type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/dns/api/v1/managedZones)' - 'Managing Zones: U(https://cloud.google.com/dns/zones/)' +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_info.py b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_info.py index af3b3f1ccf..f751c7adee 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_info.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_managed_zone_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_dns_managed_zone_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP ManagedZone -version_added: 2.8 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -46,7 +46,54 @@ options: description: - Restricts the list to return only zones with this domain name. type: list -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py index 0e347dedd8..c409fe7701 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set.py @@ -37,7 +37,7 @@ description: - The record will include the domain/subdomain name, a type (i.e. A, AAA, CAA, MX, CNAME, NS, etc) . short_description: Creates a GCP ResourceRecordSet -version_added: 2.6 +version_added: '2.6' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -81,7 +81,43 @@ options: of the gcp_dns_managed_zone module, which will contain both. required: true type: dict -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str ''' EXAMPLES = ''' @@ -362,9 +398,10 @@ def prefetch_soa_resource(module): 'name': replace_resource_dict(module.params['managed_zone'], 'dnsName'), 'project': module.params['project'], 'scopes': module.params['scopes'], - 'service_account_file': module.params['service_account_file'], + 'service_account_file': module.params.get('service_account_file'), 'auth_kind': module.params['auth_kind'], - 'service_account_email': module.params['service_account_email'], + 'service_account_email': module.params.get('service_account_email'), + 'service_account_contents': module.params.get('service_account_contents'), }, module, ) diff --git a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_info.py b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_info.py index 9b8bc4d701..2b0f6c6464 100644 --- a/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_info.py +++ b/lib/ansible/modules/cloud/google/gcp_dns_resource_record_set_info.py @@ -35,7 +35,7 @@ description: - This module was called C(gcp_dns_resource_record_set_facts) before Ansible 2.9. The usage has not changed. short_description: Gather info for GCP ResourceRecordSet -version_added: 2.8 +version_added: '2.8' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -49,7 +49,54 @@ options: of the gcp_dns_managed_zone module, which will contain both. required: true type: dict -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/google/gcp_filestore_instance.py b/lib/ansible/modules/cloud/google/gcp_filestore_instance.py index 46d0c58c9c..fb55396ef1 100644 --- a/lib/ansible/modules/cloud/google/gcp_filestore_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_filestore_instance.py @@ -33,7 +33,7 @@ module: gcp_filestore_instance description: - A Google Cloud Filestore instance. short_description: Creates a GCP Instance -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -83,7 +83,8 @@ options: type: str capacity_gb: description: - - File share capacity in GB. + - File share capacity in GiB. This must be at least 1024 GiB for the standard + tier, or 2560 GiB for the premium tier. required: true type: int networks: @@ -114,12 +115,58 @@ options: - The name of the Filestore zone of the instance. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str notes: - 'API Reference: U(https://cloud.google.com/filestore/docs/reference/rest/v1beta1/projects.locations.instances/create)' - 'Official Documentation: U(https://cloud.google.com/filestore/docs/creating-instances)' - 'Use with Kubernetes: U(https://cloud.google.com/filestore/docs/accessing-fileshares)' - 'Copying Data In/Out: U(https://cloud.google.com/filestore/docs/copying-data)' +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' @@ -181,7 +228,8 @@ fileShares: type: str capacityGb: description: - - File share capacity in GB. + - File share capacity in GiB. This must be at least 1024 GiB for the standard + tier, or 2560 GiB for the premium tier. returned: success type: int networks: diff --git a/lib/ansible/modules/cloud/google/gcp_filestore_instance_info.py b/lib/ansible/modules/cloud/google/gcp_filestore_instance_info.py index 8e26e48345..ed2518f897 100644 --- a/lib/ansible/modules/cloud/google/gcp_filestore_instance_info.py +++ b/lib/ansible/modules/cloud/google/gcp_filestore_instance_info.py @@ -33,7 +33,7 @@ module: gcp_filestore_instance_info description: - Gather info for GCP Instance short_description: Gather info for GCP Instance -version_added: 2.9 +version_added: '2.9' author: Google Inc. (@googlecloudplatform) requirements: - python >= 2.6 @@ -45,7 +45,54 @@ options: - The name of the Filestore zone of the instance. required: true type: str -extends_documentation_fragment: gcp + project: + description: + - The Google Cloud Platform project to use. + type: str + auth_kind: + description: + - The type of credential used. + type: str + required: true + choices: + - application + - machineaccount + - serviceaccount + service_account_contents: + description: + - The contents of a Service Account JSON file, either in a dictionary or as a + JSON string that represents it. + type: jsonarg + service_account_file: + description: + - The path of a Service Account JSON file if serviceaccount is selected as type. + type: path + service_account_email: + description: + - An optional service account email address if machineaccount is selected and + the user does not wish to use the default email. + type: str + scopes: + description: + - Array of scopes to be used + type: list + env_type: + description: + - Specifies which Ansible environment you're running this module within. + - This should not be set unless you know what you're doing. + - This only alters the User Agent string for any API requests. + type: str +notes: +- for authentication, you can set service_account_file using the c(gcp_service_account_file) + env variable. +- for authentication, you can set service_account_contents using the c(GCP_SERVICE_ACCOUNT_CONTENTS) + env variable. +- For authentication, you can set service_account_email using the C(GCP_SERVICE_ACCOUNT_EMAIL) + env variable. +- For authentication, you can set auth_kind using the C(GCP_AUTH_KIND) env variable. +- For authentication, you can set scopes using the C(GCP_SCOPES) env variable. +- Environment variables values will only be used if the playbook values are not set. +- The I(service_account_email) and I(service_account_file) options are mutually exclusive. ''' EXAMPLES = ''' @@ -102,7 +149,8 @@ resources: type: str capacityGb: description: - - File share capacity in GB. + - File share capacity in GiB. This must be at least 1024 GiB for the standard + tier, or 2560 GiB for the premium tier. returned: success type: int networks: diff --git a/test/integration/targets/gcp_compute_target_pool/tasks/autogen.yml b/test/integration/targets/gcp_compute_target_pool/tasks/autogen.yml new file mode 100644 index 0000000000..756a5cccf9 --- /dev/null +++ b/test/integration/targets/gcp_compute_target_pool/tasks/autogen.yml @@ -0,0 +1,109 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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: delete a target pool + gcp_compute_target_pool: + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a target pool + gcp_compute_target_pool: + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that target_pool was created + gcp_compute_target_pool_info: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 1 +# ---------------------------------------------------------------------------- +- name: create a target pool that already exists + gcp_compute_target_pool: + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a target pool + gcp_compute_target_pool: + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that target_pool was deleted + gcp_compute_target_pool_info: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a target pool that does not exist + gcp_compute_target_pool: + name: "{{ resource_name }}" + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_compute_target_pool/tasks/main.yml b/test/integration/targets/gcp_compute_target_pool/tasks/main.yml index 756a5cccf9..45d6e49178 100644 --- a/test/integration/targets/gcp_compute_target_pool/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_pool/tasks/main.yml @@ -1,109 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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: delete a target pool - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target pool - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that target_pool was created - gcp_compute_target_pool_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target pool that already exists - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a target pool - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that target_pool was deleted - gcp_compute_target_pool_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target pool that does not exist - gcp_compute_target_pool: - name: "{{ resource_name }}" - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml new file mode 100644 index 0000000000..f9da704f7e --- /dev/null +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/autogen.yml @@ -0,0 +1,266 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 instance group + gcp_compute_instance_group: + name: instancegroup-targetsslproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: instancegroup +- name: create a health check + gcp_compute_health_check: + name: healthcheck-targetsslproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: healthcheck +- name: create a backend service + gcp_compute_backend_service: + name: backendservice-targetsslproxy + backends: + - group: "{{ instancegroup.selfLink }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: SSL + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: backendservice +- name: create a SSL certificate + gcp_compute_ssl_certificate: + name: sslcert-targetsslproxy + description: A certificate for testing. Do not use this certificate in production + certificate: |- + -----BEGIN CERTIFICATE----- + MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT + BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN + AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP + BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z + aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ + 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn + 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ + zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE----- + private_key: |- + -----BEGIN EC PRIVATE KEY----- + MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f + OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY----- + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: sslcert +- name: delete a target SSL proxy + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a target SSL proxy + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that target_ssl_proxy was created + gcp_compute_target_ssl_proxy_info: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 1 +# ---------------------------------------------------------------------------- +- name: create a target SSL proxy that already exists + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a target SSL proxy + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that target_ssl_proxy was deleted + gcp_compute_target_ssl_proxy_info: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a target SSL proxy that does not exist + gcp_compute_target_ssl_proxy: + name: "{{ resource_name }}" + ssl_certificates: + - "{{ sslcert }}" + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#--------------------------------------------------------- +# Post-test teardown +# If errors happen, don't crash the playbook! +- name: delete a SSL certificate + gcp_compute_ssl_certificate: + name: sslcert-targetsslproxy + description: A certificate for testing. Do not use this certificate in production + certificate: |- + -----BEGIN CERTIFICATE----- + MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG + EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT + BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm + b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN + AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 + MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP + BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM + FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z + aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH + KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ + 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O + BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn + 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O + M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ + zqGNhIPGq2ULqXKK8BY= + -----END CERTIFICATE----- + private_key: |- + -----BEGIN EC PRIVATE KEY----- + MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 + AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f + OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== + -----END EC PRIVATE KEY----- + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: sslcert + ignore_errors: true +- name: delete a backend service + gcp_compute_backend_service: + name: backendservice-targetsslproxy + backends: + - group: "{{ instancegroup.selfLink }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: SSL + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: backendservice + ignore_errors: true +- name: delete a health check + gcp_compute_health_check: + name: healthcheck-targetsslproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true +- name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-targetsslproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml index f9da704f7e..45d6e49178 100644 --- a/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -1,266 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 instance group - gcp_compute_instance_group: - name: instancegroup-targetsslproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a health check - gcp_compute_health_check: - name: healthcheck-targetsslproxy - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-targetsslproxy - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: SSL - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: backendservice -- name: create a SSL certificate - gcp_compute_ssl_certificate: - name: sslcert-targetsslproxy - description: A certificate for testing. Do not use this certificate in production - certificate: |- - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: |- - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: sslcert -- name: delete a target SSL proxy - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target SSL proxy - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that target_ssl_proxy was created - gcp_compute_target_ssl_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target SSL proxy that already exists - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a target SSL proxy - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that target_ssl_proxy was deleted - gcp_compute_target_ssl_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target SSL proxy that does not exist - gcp_compute_target_ssl_proxy: - name: "{{ resource_name }}" - ssl_certificates: - - "{{ sslcert }}" - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a SSL certificate - gcp_compute_ssl_certificate: - name: sslcert-targetsslproxy - description: A certificate for testing. Do not use this certificate in production - certificate: |- - -----BEGIN CERTIFICATE----- - MIICqjCCAk+gAwIBAgIJAIuJ+0352Kq4MAoGCCqGSM49BAMCMIGwMQswCQYDVQQG - EwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjERMA8GA1UEBwwIS2lya2xhbmQxFTAT - BgNVBAoMDEdvb2dsZSwgSW5jLjEeMBwGA1UECwwVR29vZ2xlIENsb3VkIFBsYXRm - b3JtMR8wHQYDVQQDDBZ3d3cubXktc2VjdXJlLXNpdGUuY29tMSEwHwYJKoZIhvcN - AQkBFhJuZWxzb25hQGdvb2dsZS5jb20wHhcNMTcwNjI4MDQ1NjI2WhcNMjcwNjI2 - MDQ1NjI2WjCBsDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24xETAP - BgNVBAcMCEtpcmtsYW5kMRUwEwYDVQQKDAxHb29nbGUsIEluYy4xHjAcBgNVBAsM - FUdvb2dsZSBDbG91ZCBQbGF0Zm9ybTEfMB0GA1UEAwwWd3d3Lm15LXNlY3VyZS1z - aXRlLmNvbTEhMB8GCSqGSIb3DQEJARYSbmVsc29uYUBnb29nbGUuY29tMFkwEwYH - KoZIzj0CAQYIKoZIzj0DAQcDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ - 4mzkzTv0dXyB750fOGN02HtkpBOZzzvUARTR10JQoSe2/5PIwaNQME4wHQYDVR0O - BBYEFKIQC3A2SDpxcdfn0YLKineDNq/BMB8GA1UdIwQYMBaAFKIQC3A2SDpxcdfn - 0YLKineDNq/BMAwGA1UdEwQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhALs4vy+O - M3jcqgA4fSW/oKw6UJxp+M6a+nGMX+UJR3YgAiEAvvl39QRVAiv84hdoCuyON0lJ - zqGNhIPGq2ULqXKK8BY= - -----END CERTIFICATE----- - private_key: |- - -----BEGIN EC PRIVATE KEY----- - MHcCAQEEIObtRo8tkUqoMjeHhsOh2ouPpXCgBcP+EDxZCB/tws15oAoGCCqGSM49 - AwEHoUQDQgAEHGzpcRJ4XzfBJCCPMQeXQpTXwlblimODQCuQ4mzkzTv0dXyB750f - OGN02HtkpBOZzzvUARTR10JQoSe2/5PIwQ== - -----END EC PRIVATE KEY----- - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: sslcert - ignore_errors: true -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-targetsslproxy - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: SSL - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: backendservice - ignore_errors: true -- name: delete a health check - gcp_compute_health_check: - name: healthcheck-targetsslproxy - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-targetsslproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml new file mode 100644 index 0000000000..8385d591b7 --- /dev/null +++ b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/autogen.yml @@ -0,0 +1,194 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 instance group + gcp_compute_instance_group: + name: instancegroup-targettcpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: instancegroup +- name: create a health check + gcp_compute_health_check: + name: healthcheck-targettcpproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: healthcheck +- name: create a backend service + gcp_compute_backend_service: + name: backendservice-targettcpproxy + backends: + - group: "{{ instancegroup.selfLink }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: TCP + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: backendservice +- name: delete a target TCP proxy + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a target TCP proxy + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that target_tcp_proxy was created + gcp_compute_target_tcp_proxy_info: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 1 +# ---------------------------------------------------------------------------- +- name: create a target TCP proxy that already exists + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a target TCP proxy + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that target_tcp_proxy was deleted + gcp_compute_target_tcp_proxy_info: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a target TCP proxy that does not exist + gcp_compute_target_tcp_proxy: + name: "{{ resource_name }}" + proxy_header: PROXY_V1 + service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#--------------------------------------------------------- +# Post-test teardown +# If errors happen, don't crash the playbook! +- name: delete a backend service + gcp_compute_backend_service: + name: backendservice-targettcpproxy + backends: + - group: "{{ instancegroup.selfLink }}" + health_checks: + - "{{ healthcheck.selfLink }}" + protocol: TCP + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: backendservice + ignore_errors: true +- name: delete a health check + gcp_compute_health_check: + name: healthcheck-targettcpproxy + type: TCP + tcp_health_check: + port_name: service-health + request: ping + response: pong + healthy_threshold: 10 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true +- name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-targettcpproxy + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml index 8385d591b7..45d6e49178 100644 --- a/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -1,194 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 instance group - gcp_compute_instance_group: - name: instancegroup-targettcpproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a health check - gcp_compute_health_check: - name: healthcheck-targettcpproxy - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-targettcpproxy - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: TCP - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: backendservice -- name: delete a target TCP proxy - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target TCP proxy - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that target_tcp_proxy was created - gcp_compute_target_tcp_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target TCP proxy that already exists - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a target TCP proxy - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that target_tcp_proxy was deleted - gcp_compute_target_tcp_proxy_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target TCP proxy that does not exist - gcp_compute_target_tcp_proxy: - name: "{{ resource_name }}" - proxy_header: PROXY_V1 - service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-targettcpproxy - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" - protocol: TCP - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: backendservice - ignore_errors: true -- name: delete a health check - gcp_compute_health_check: - name: healthcheck-targettcpproxy - type: TCP - tcp_health_check: - port_name: service-health - request: ping - response: pong - healthy_threshold: 10 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-targettcpproxy - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml new file mode 100644 index 0000000000..6fd3d01dd0 --- /dev/null +++ b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/autogen.yml @@ -0,0 +1,153 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 address + gcp_compute_address: + name: address-vpngateway + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: address +- name: create a network + gcp_compute_network: + name: network-vpngateway + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network +- name: delete a target vpn gateway + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a target vpn gateway + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that target_vpn_gateway was created + gcp_compute_target_vpn_gateway_info: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 1 +# ---------------------------------------------------------------------------- +- name: create a target vpn gateway that already exists + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a target vpn gateway + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that target_vpn_gateway was deleted + gcp_compute_target_vpn_gateway_info: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a target vpn gateway that does not exist + gcp_compute_target_vpn_gateway: + name: "{{ resource_name }}" + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#--------------------------------------------------------- +# Post-test teardown +# If errors happen, don't crash the playbook! +- name: delete a network + gcp_compute_network: + name: network-vpngateway + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true +- name: delete a address + gcp_compute_address: + name: address-vpngateway + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: address + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml index 6fd3d01dd0..45d6e49178 100644 --- a/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/test/integration/targets/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -1,153 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 address - gcp_compute_address: - name: address-vpngateway - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: address -- name: create a network - gcp_compute_network: - name: network-vpngateway - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: delete a target vpn gateway - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a target vpn gateway - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that target_vpn_gateway was created - gcp_compute_target_vpn_gateway_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a target vpn gateway that already exists - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a target vpn gateway - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that target_vpn_gateway was deleted - gcp_compute_target_vpn_gateway_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a target vpn gateway that does not exist - gcp_compute_target_vpn_gateway: - name: "{{ resource_name }}" - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a network - gcp_compute_network: - name: network-vpngateway - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true -- name: delete a address - gcp_compute_address: - name: address-vpngateway - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: address - ignore_errors: true +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_compute_url_map/tasks/autogen.yml b/test/integration/targets/gcp_compute_url_map/tasks/autogen.yml new file mode 100644 index 0000000000..b05a23a18b --- /dev/null +++ b/test/integration/targets/gcp_compute_url_map/tasks/autogen.yml @@ -0,0 +1,181 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 instance group + gcp_compute_instance_group: + name: instancegroup-urlmap + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: instancegroup +- name: create a HTTP health check + gcp_compute_http_health_check: + name: httphealthcheck-urlmap + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: healthcheck +- name: create a backend service + gcp_compute_backend_service: + name: backendservice-urlmap + backends: + - group: "{{ instancegroup.selfLink }}" + health_checks: + - "{{ healthcheck.selfLink }}" + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: backendservice +- name: delete a URL map + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a URL map + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that url_map was created + gcp_compute_url_map_info: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 1 +# ---------------------------------------------------------------------------- +- name: create a URL map that already exists + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a URL map + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that url_map was deleted + gcp_compute_url_map_info: + filters: + - name = {{ resource_name }} + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a URL map that does not exist + gcp_compute_url_map: + name: "{{ resource_name }}" + default_service: "{{ backendservice }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#--------------------------------------------------------- +# Post-test teardown +# If errors happen, don't crash the playbook! +- name: delete a backend service + gcp_compute_backend_service: + name: backendservice-urlmap + backends: + - group: "{{ instancegroup.selfLink }}" + health_checks: + - "{{ healthcheck.selfLink }}" + enable_cdn: 'true' + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: backendservice + ignore_errors: true +- name: delete a HTTP health check + gcp_compute_http_health_check: + name: httphealthcheck-urlmap + healthy_threshold: 10 + port: 8080 + timeout_sec: 2 + unhealthy_threshold: 5 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: healthcheck + ignore_errors: true +- name: delete a instance group + gcp_compute_instance_group: + name: instancegroup-urlmap + zone: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: instancegroup + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_url_map/tasks/main.yml b/test/integration/targets/gcp_compute_url_map/tasks/main.yml index b05a23a18b..45d6e49178 100644 --- a/test/integration/targets/gcp_compute_url_map/tasks/main.yml +++ b/test/integration/targets/gcp_compute_url_map/tasks/main.yml @@ -1,181 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 instance group - gcp_compute_instance_group: - name: instancegroup-urlmap - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: instancegroup -- name: create a HTTP health check - gcp_compute_http_health_check: - name: httphealthcheck-urlmap - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: healthcheck -- name: create a backend service - gcp_compute_backend_service: - name: backendservice-urlmap - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: backendservice -- name: delete a URL map - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a URL map - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that url_map was created - gcp_compute_url_map_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a URL map that already exists - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a URL map - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that url_map was deleted - gcp_compute_url_map_info: - filters: - - name = {{ resource_name }} - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a URL map that does not exist - gcp_compute_url_map: - name: "{{ resource_name }}" - default_service: "{{ backendservice }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a backend service - gcp_compute_backend_service: - name: backendservice-urlmap - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" - enable_cdn: 'true' - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: backendservice - ignore_errors: true -- name: delete a HTTP health check - gcp_compute_http_health_check: - name: httphealthcheck-urlmap - healthy_threshold: 10 - port: 8080 - timeout_sec: 2 - unhealthy_threshold: 5 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: healthcheck - ignore_errors: true -- name: delete a instance group - gcp_compute_instance_group: - name: instancegroup-urlmap - zone: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: instancegroup - ignore_errors: true +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml new file mode 100644 index 0000000000..abd5dbb6d2 --- /dev/null +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/autogen.yml @@ -0,0 +1,202 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 network + gcp_compute_network: + name: network-vpn-tunnel + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: network +- name: create a router + gcp_compute_router: + name: router-vpn-tunnel + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: router +- name: create a target vpn gateway + gcp_compute_target_vpn_gateway: + name: gateway-vpn-tunnel + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: gateway +- name: delete a vpn tunnel + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a vpn tunnel + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that vpn_tunnel was created + gcp_compute_vpn_tunnel_info: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 1 +# ---------------------------------------------------------------------------- +- name: create a vpn tunnel that already exists + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a vpn tunnel + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that vpn_tunnel was deleted + gcp_compute_vpn_tunnel_info: + filters: + - name = {{ resource_name }} + region: us-west1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/compute + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a vpn tunnel that does not exist + gcp_compute_vpn_tunnel: + name: "{{ resource_name }}" + region: us-west1 + target_vpn_gateway: "{{ gateway }}" + router: "{{ router }}" + shared_secret: super secret + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#--------------------------------------------------------- +# Post-test teardown +# If errors happen, don't crash the playbook! +- name: delete a target vpn gateway + gcp_compute_target_vpn_gateway: + name: gateway-vpn-tunnel + region: us-west1 + network: "{{ network }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: gateway + ignore_errors: true +- name: delete a router + gcp_compute_router: + name: router-vpn-tunnel + network: "{{ network }}" + bgp: + asn: 64514 + advertise_mode: CUSTOM + advertised_groups: + - ALL_SUBNETS + advertised_ip_ranges: + - range: 1.2.3.4 + - range: 6.7.0.0/16 + region: us-central1 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: router + ignore_errors: true +- name: delete a network + gcp_compute_network: + name: network-vpn-tunnel + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: network + ignore_errors: true diff --git a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml index abd5dbb6d2..45d6e49178 100644 --- a/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/test/integration/targets/gcp_compute_vpn_tunnel/tasks/main.yml @@ -1,202 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 network - gcp_compute_network: - name: network-vpn-tunnel - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: network -- name: create a router - gcp_compute_router: - name: router-vpn-tunnel - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: router -- name: create a target vpn gateway - gcp_compute_target_vpn_gateway: - name: gateway-vpn-tunnel - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: gateway -- name: delete a vpn tunnel - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a vpn tunnel - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that vpn_tunnel was created - gcp_compute_vpn_tunnel_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a vpn tunnel that already exists - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a vpn tunnel - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that vpn_tunnel was deleted - gcp_compute_vpn_tunnel_info: - filters: - - name = {{ resource_name }} - region: us-west1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/compute - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a vpn tunnel that does not exist - gcp_compute_vpn_tunnel: - name: "{{ resource_name }}" - region: us-west1 - target_vpn_gateway: "{{ gateway }}" - router: "{{ router }}" - shared_secret: super secret - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete a target vpn gateway - gcp_compute_target_vpn_gateway: - name: gateway-vpn-tunnel - region: us-west1 - network: "{{ network }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: gateway - ignore_errors: true -- name: delete a router - gcp_compute_router: - name: router-vpn-tunnel - network: "{{ network }}" - bgp: - asn: 64514 - advertise_mode: CUSTOM - advertised_groups: - - ALL_SUBNETS - advertised_ip_ranges: - - range: 1.2.3.4 - - range: 6.7.0.0/16 - region: us-central1 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: router - ignore_errors: true -- name: delete a network - gcp_compute_network: - name: network-vpn-tunnel - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: network - ignore_errors: true +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_container_cluster/tasks/autogen.yml b/test/integration/targets/gcp_container_cluster/tasks/autogen.yml new file mode 100644 index 0000000000..1581a30fbb --- /dev/null +++ b/test/integration/targets/gcp_container_cluster/tasks/autogen.yml @@ -0,0 +1,140 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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: delete a cluster + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a cluster + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that cluster was created + gcp_container_cluster_info: + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\"" +# ---------------------------------------------------------------------------- +- name: create a cluster that already exists + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a cluster + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that cluster was deleted + gcp_container_cluster_info: + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" +# ---------------------------------------------------------------------------- +- name: delete a cluster that does not exist + gcp_container_cluster: + name: my-cluster + initial_node_count: 2 + master_auth: + username: cluster_admin + password: my-secret-password + node_config: + machine_type: n1-standard-4 + disk_size_gb: 500 + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_container_cluster/tasks/main.yml b/test/integration/targets/gcp_container_cluster/tasks/main.yml index 1581a30fbb..45d6e49178 100644 --- a/test/integration/targets/gcp_container_cluster/tasks/main.yml +++ b/test/integration/targets/gcp_container_cluster/tasks/main.yml @@ -1,140 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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: delete a cluster - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a cluster - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that cluster was created - gcp_container_cluster_info: - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - "'my-cluster' in \"{{ results['resources'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a cluster that already exists - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a cluster - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that cluster was deleted - gcp_container_cluster_info: - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - "'my-cluster' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a cluster that does not exist - gcp_container_cluster: - name: my-cluster - initial_node_count: 2 - master_auth: - username: cluster_admin - password: my-secret-password - node_config: - machine_type: n1-standard-4 - disk_size_gb: 500 - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_container_node_pool/tasks/autogen.yml b/test/integration/targets/gcp_container_node_pool/tasks/autogen.yml new file mode 100644 index 0000000000..d62b747059 --- /dev/null +++ b/test/integration/targets/gcp_container_node_pool/tasks/autogen.yml @@ -0,0 +1,141 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 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 + register: cluster +- name: delete a node pool + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a node pool + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that node_pool was created + gcp_container_node_pool_info: + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\"" +# ---------------------------------------------------------------------------- +- name: create a node pool that already exists + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a node pool + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that node_pool was deleted + gcp_container_node_pool_info: + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" +# ---------------------------------------------------------------------------- +- name: delete a node pool that does not exist + gcp_container_node_pool: + name: my-pool + initial_node_count: 4 + cluster: "{{ cluster }}" + location: us-central1-a + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#--------------------------------------------------------- +# Post-test teardown +# If errors happen, don't crash the playbook! +- name: delete 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: absent + register: cluster + ignore_errors: true diff --git a/test/integration/targets/gcp_container_node_pool/tasks/main.yml b/test/integration/targets/gcp_container_node_pool/tasks/main.yml index d62b747059..45d6e49178 100644 --- a/test/integration/targets/gcp_container_node_pool/tasks/main.yml +++ b/test/integration/targets/gcp_container_node_pool/tasks/main.yml @@ -1,141 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 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 - register: cluster -- name: delete a node pool - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a node pool - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that node_pool was created - gcp_container_node_pool_info: - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - "'my-pool' in \"{{ results['resources'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: create a node pool that already exists - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a node pool - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that node_pool was deleted - gcp_container_node_pool_info: - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - "'my-pool' not in \"{{ results['resources'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- name: delete a node pool that does not exist - gcp_container_node_pool: - name: my-pool - initial_node_count: 4 - cluster: "{{ cluster }}" - location: us-central1-a - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- name: delete 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: absent - register: cluster - ignore_errors: true +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml b/test/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml new file mode 100644 index 0000000000..21ce21009f --- /dev/null +++ b/test/integration/targets/gcp_dns_managed_zone/tasks/autogen.yml @@ -0,0 +1,110 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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: delete a managed zone + gcp_dns_managed_zone: + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a managed zone + gcp_dns_managed_zone: + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that managed_zone was created + gcp_dns_managed_zone_info: + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 1 +# ---------------------------------------------------------------------------- +- name: create a managed zone that already exists + gcp_dns_managed_zone: + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a managed zone + gcp_dns_managed_zone: + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that managed_zone was deleted + gcp_dns_managed_zone_info: + dns_name: test.somewild2.example.com. + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a managed zone that does not exist + gcp_dns_managed_zone: + name: "{{ resource_name }}" + dns_name: test.somewild2.example.com. + description: test zone + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml b/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml index 21ce21009f..45d6e49178 100644 --- a/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml +++ b/test/integration/targets/gcp_dns_managed_zone/tasks/main.yml @@ -1,110 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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: delete a managed zone - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a managed zone - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that managed_zone was created - gcp_dns_managed_zone_info: - dns_name: test.somewild2.example.com. - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 1 -# ---------------------------------------------------------------------------- -- name: create a managed zone that already exists - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a managed zone - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that managed_zone was deleted - gcp_dns_managed_zone_info: - dns_name: test.somewild2.example.com. - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a managed zone that does not exist - gcp_dns_managed_zone: - name: "{{ resource_name }}" - dns_name: test.somewild2.example.com. - description: test zone - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml new file mode 100644 index 0000000000..8b5529656a --- /dev/null +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/autogen.yml @@ -0,0 +1,154 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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 }}" + 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 }}" + 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 }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that resource_record_set was created + gcp_dns_resource_record_set_info: + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results +- name: verify that command succeeded + assert: + that: + - "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\"" +# ---------------------------------------------------------------------------- +- 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 }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- 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 }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that resource_record_set was deleted + gcp_dns_resource_record_set_info: + managed_zone: "{{ managed_zone }}" + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/ndev.clouddns.readwrite + register: results +- name: verify that command succeeded + assert: + that: + - "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\"" +# ---------------------------------------------------------------------------- +- 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 }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#--------------------------------------------------------- +# Post-test teardown +# If errors happen, don't crash the playbook! +- 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 }}" + state: absent + register: managed_zone + ignore_errors: true diff --git a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml index 8b5529656a..45d6e49178 100644 --- a/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml +++ b/test/integration/targets/gcp_dns_resource_record_set/tasks/main.yml @@ -1,154 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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 }}" - 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 }}" - 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 }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that resource_record_set was created - gcp_dns_resource_record_set_info: - managed_zone: "{{ managed_zone }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite - register: results -- name: verify that command succeeded - assert: - that: - - "'www.testzone-4.com.'in \"{{ results['resources'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- 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 }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- 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 }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that resource_record_set was deleted - gcp_dns_resource_record_set_info: - managed_zone: "{{ managed_zone }}" - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/ndev.clouddns.readwrite - register: results -- name: verify that command succeeded - assert: - that: - - "'www.testzone-4.com.'not in \"{{ results['resources'] | map(attribute='name') | list }}\"" -# ---------------------------------------------------------------------------- -- 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 }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#--------------------------------------------------------- -# Post-test teardown -# If errors happen, don't crash the playbook! -- 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 }}" - state: absent - register: managed_zone - ignore_errors: true +- include_tasks: autogen.yml diff --git a/test/integration/targets/gcp_filestore_instance/tasks/autogen.yml b/test/integration/targets/gcp_filestore_instance/tasks/autogen.yml new file mode 100644 index 0000000000..4713f094b0 --- /dev/null +++ b/test/integration/targets/gcp_filestore_instance/tasks/autogen.yml @@ -0,0 +1,145 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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: delete a instance + gcp_filestore_instance: + name: "{{ resource_name }}" + zone: us-central1-b + tier: PREMIUM + file_shares: + - capacity_gb: 2660 + name: share1 + networks: + - network: default + modes: + - MODE_IPV4 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent +#---------------------------------------------------------- +- name: create a instance + gcp_filestore_instance: + name: "{{ resource_name }}" + zone: us-central1-b + tier: PREMIUM + file_shares: + - capacity_gb: 2660 + name: share1 + networks: + - network: default + modes: + - MODE_IPV4 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that instance was created + gcp_filestore_instance_info: + zone: us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 +# ---------------------------------------------------------------------------- +- name: create a instance that already exists + gcp_filestore_instance: + name: "{{ resource_name }}" + zone: us-central1-b + tier: PREMIUM + file_shares: + - capacity_gb: 2660 + name: share1 + networks: + - network: default + modes: + - MODE_IPV4 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: present + register: result +- name: assert changed is false + assert: + that: + - result.changed == false +#---------------------------------------------------------- +- name: delete a instance + gcp_filestore_instance: + name: "{{ resource_name }}" + zone: us-central1-b + tier: PREMIUM + file_shares: + - capacity_gb: 2660 + name: share1 + networks: + - network: default + modes: + - MODE_IPV4 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is true + assert: + that: + - result.changed == true +- name: verify that instance was deleted + gcp_filestore_instance_info: + zone: us-central1-b + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + scopes: + - https://www.googleapis.com/auth/cloud-platform + register: results +- name: verify that command succeeded + assert: + that: + - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 +# ---------------------------------------------------------------------------- +- name: delete a instance that does not exist + gcp_filestore_instance: + name: "{{ resource_name }}" + zone: us-central1-b + tier: PREMIUM + file_shares: + - capacity_gb: 2660 + name: share1 + networks: + - network: default + modes: + - MODE_IPV4 + project: "{{ gcp_project }}" + auth_kind: "{{ gcp_cred_kind }}" + service_account_file: "{{ gcp_cred_file }}" + state: absent + register: result +- name: assert changed is false + assert: + that: + - result.changed == false diff --git a/test/integration/targets/gcp_filestore_instance/tasks/main.yml b/test/integration/targets/gcp_filestore_instance/tasks/main.yml index 4713f094b0..45d6e49178 100644 --- a/test/integration/targets/gcp_filestore_instance/tasks/main.yml +++ b/test/integration/targets/gcp_filestore_instance/tasks/main.yml @@ -1,145 +1,2 @@ --- -# ---------------------------------------------------------------------------- -# -# *** 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: delete a instance - gcp_filestore_instance: - name: "{{ resource_name }}" - zone: us-central1-b - tier: PREMIUM - file_shares: - - capacity_gb: 2660 - name: share1 - networks: - - network: default - modes: - - MODE_IPV4 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent -#---------------------------------------------------------- -- name: create a instance - gcp_filestore_instance: - name: "{{ resource_name }}" - zone: us-central1-b - tier: PREMIUM - file_shares: - - capacity_gb: 2660 - name: share1 - networks: - - network: default - modes: - - MODE_IPV4 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that instance was created - gcp_filestore_instance_info: - zone: us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 1 -# ---------------------------------------------------------------------------- -- name: create a instance that already exists - gcp_filestore_instance: - name: "{{ resource_name }}" - zone: us-central1-b - tier: PREMIUM - file_shares: - - capacity_gb: 2660 - name: share1 - networks: - - network: default - modes: - - MODE_IPV4 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: present - register: result -- name: assert changed is false - assert: - that: - - result.changed == false -#---------------------------------------------------------- -- name: delete a instance - gcp_filestore_instance: - name: "{{ resource_name }}" - zone: us-central1-b - tier: PREMIUM - file_shares: - - capacity_gb: 2660 - name: share1 - networks: - - network: default - modes: - - MODE_IPV4 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is true - assert: - that: - - result.changed == true -- name: verify that instance was deleted - gcp_filestore_instance_info: - zone: us-central1-b - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - scopes: - - https://www.googleapis.com/auth/cloud-platform - register: results -- name: verify that command succeeded - assert: - that: - - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}.*") | list | length == 0 -# ---------------------------------------------------------------------------- -- name: delete a instance that does not exist - gcp_filestore_instance: - name: "{{ resource_name }}" - zone: us-central1-b - tier: PREMIUM - file_shares: - - capacity_gb: 2660 - name: share1 - networks: - - network: default - modes: - - MODE_IPV4 - project: "{{ gcp_project }}" - auth_kind: "{{ gcp_cred_kind }}" - service_account_file: "{{ gcp_cred_file }}" - state: absent - register: result -- name: assert changed is false - assert: - that: - - result.changed == false +- include_tasks: autogen.yml