diff --git a/plugins/modules/gcp_iam_service_account.py b/plugins/modules/gcp_iam_service_account.py index 47a0587..46674cb 100644 --- a/plugins/modules/gcp_iam_service_account.py +++ b/plugins/modules/gcp_iam_service_account.py @@ -61,7 +61,7 @@ extends_documentation_fragment: gcp EXAMPLES = ''' - name: create a service account gcp_iam_service_account: - name: "{{ sa_name }}" + name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com display_name: My Ansible test key project: test_project auth_kind: serviceaccount diff --git a/plugins/modules/gcp_iam_service_account_facts.py b/plugins/modules/gcp_iam_service_account_facts.py index 0f4c760..09b4173 100644 --- a/plugins/modules/gcp_iam_service_account_facts.py +++ b/plugins/modules/gcp_iam_service_account_facts.py @@ -108,8 +108,8 @@ def main(): module.params['scopes'] = ['https://www.googleapis.com/auth/iam'] items = fetch_list(module, collection(module)) - if items.get('items'): - items = items.get('items') + if items.get('accounts'): + items = items.get('accounts') else: items = [] return_value = {'resources': items} diff --git a/plugins/modules/gcp_pubsub_subscription.py b/plugins/modules/gcp_pubsub_subscription.py index 392ee15..5aaa6e3 100644 --- a/plugins/modules/gcp_pubsub_subscription.py +++ b/plugins/modules/gcp_pubsub_subscription.py @@ -484,7 +484,11 @@ def decode_request(response, module): def encode_request(request, module): - request['topic'] = '/'.join(['projects', module.params['project'], 'topics', replace_resource_dict(request['topic'], 'name')]) + if isinstance(module.params.get('topic'), dict): + request['topic'] = '/'.join(['projects', module.params['project'], 'topics', replace_resource_dict(module.params.get(u'topic', {}), 'name')]) + else: + request['topic'] = '/'.join(['projects', module.params['project'], 'topics', module.params['topic']]) + request['name'] = '/'.join(['projects', module.params['project'], 'subscriptions', module.params['name']]) return request diff --git a/tests/integration/gcp_bigquery_dataset/tasks/main.yml b/tests/integration/gcp_bigquery_dataset/tasks/main.yml index 609caf1..0eba0b4 100644 --- a/tests/integration/gcp_bigquery_dataset/tasks/main.yml +++ b/tests/integration/gcp_bigquery_dataset/tasks/main.yml @@ -49,7 +49,7 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*my_example_dataset.*") | list | length == 1 + - results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a dataset that already exists gcp_bigquery_dataset: @@ -81,7 +81,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that dataset was deleted gcp_bigquery_dataset_facts: project: "{{ gcp_project }}" @@ -93,7 +92,7 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*my_example_dataset.*") | list | length == 0 + - results['resources'] | map(attribute='datasetReference') | map(attribute='datasetId') | select("match", ".*my_example_dataset.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a dataset that does not exist gcp_bigquery_dataset: @@ -109,4 +108,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_bigquery_table/tasks/main.yml b/tests/integration/gcp_bigquery_table/tasks/main.yml index a06a71b..8d45409 100644 --- a/tests/integration/gcp_bigquery_table/tasks/main.yml +++ b/tests/integration/gcp_bigquery_table/tasks/main.yml @@ -66,7 +66,7 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*example_table.*") | list | length == 1 + - results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a table that already exists gcp_bigquery_table: @@ -104,7 +104,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that table was deleted gcp_bigquery_table_facts: dataset: example_dataset @@ -117,7 +116,7 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*example_table.*") | list | length == 0 + - results['resources'] | map(attribute='tableReference') | map(attribute='tableId') | select("match", ".*example_table.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a table that does not exist gcp_bigquery_table: @@ -136,7 +135,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_address/tasks/main.yml b/tests/integration/gcp_compute_address/tasks/main.yml index 0bffaf6..7163123 100644 --- a/tests/integration/gcp_compute_address/tasks/main.yml +++ b/tests/integration/gcp_compute_address/tasks/main.yml @@ -80,7 +80,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that address was deleted gcp_compute_address_facts: filters: @@ -110,4 +109,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_backend_bucket/tasks/main.yml b/tests/integration/gcp_compute_backend_bucket/tasks/main.yml index fe5a58a..35c452d 100644 --- a/tests/integration/gcp_compute_backend_bucket/tasks/main.yml +++ b/tests/integration/gcp_compute_backend_bucket/tasks/main.yml @@ -95,7 +95,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that backend_bucket was deleted gcp_compute_backend_bucket_facts: filters: @@ -126,7 +125,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_backend_service/tasks/main.yml b/tests/integration/gcp_compute_backend_service/tasks/main.yml index 5b69756..8e49959 100644 --- a/tests/integration/gcp_compute_backend_service/tasks/main.yml +++ b/tests/integration/gcp_compute_backend_service/tasks/main.yml @@ -116,7 +116,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that backend_service was deleted gcp_compute_backend_service_facts: filters: @@ -149,7 +148,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_disk/tasks/main.yml b/tests/integration/gcp_compute_disk/tasks/main.yml index 778b5e7..bc524b1 100644 --- a/tests/integration/gcp_compute_disk/tasks/main.yml +++ b/tests/integration/gcp_compute_disk/tasks/main.yml @@ -92,7 +92,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that disk was deleted gcp_compute_disk_facts: filters: @@ -125,4 +124,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_firewall/tasks/main.yml b/tests/integration/gcp_compute_firewall/tasks/main.yml index 6e3b4ef..b58e1fd 100644 --- a/tests/integration/gcp_compute_firewall/tasks/main.yml +++ b/tests/integration/gcp_compute_firewall/tasks/main.yml @@ -111,7 +111,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that firewall was deleted gcp_compute_firewall_facts: filters: @@ -148,4 +147,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_forwarding_rule/tasks/main.yml b/tests/integration/gcp_compute_forwarding_rule/tasks/main.yml index 565279f..facd4da 100644 --- a/tests/integration/gcp_compute_forwarding_rule/tasks/main.yml +++ b/tests/integration/gcp_compute_forwarding_rule/tasks/main.yml @@ -114,7 +114,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that forwarding_rule was deleted gcp_compute_forwarding_rule_facts: filters: @@ -148,7 +147,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_global_address/tasks/main.yml b/tests/integration/gcp_compute_global_address/tasks/main.yml index fa633dc..c0cc109 100644 --- a/tests/integration/gcp_compute_global_address/tasks/main.yml +++ b/tests/integration/gcp_compute_global_address/tasks/main.yml @@ -75,7 +75,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that global_address was deleted gcp_compute_global_address_facts: filters: @@ -103,4 +102,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_global_forwarding_rule/tasks/main.yml b/tests/integration/gcp_compute_global_forwarding_rule/tasks/main.yml index b33eebd..91eae25 100644 --- a/tests/integration/gcp_compute_global_forwarding_rule/tasks/main.yml +++ b/tests/integration/gcp_compute_global_forwarding_rule/tasks/main.yml @@ -151,7 +151,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that global_forwarding_rule was deleted gcp_compute_global_forwarding_rule_facts: filters: @@ -183,7 +182,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_health_check/tasks/main.yml b/tests/integration/gcp_compute_health_check/tasks/main.yml index 7202c9a..13a5fd6 100644 --- a/tests/integration/gcp_compute_health_check/tasks/main.yml +++ b/tests/integration/gcp_compute_health_check/tasks/main.yml @@ -107,7 +107,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that health_check was deleted gcp_compute_health_check_facts: filters: @@ -143,4 +142,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_http_health_check/tasks/main.yml b/tests/integration/gcp_compute_http_health_check/tasks/main.yml index 2dd40b2..62fa3d3 100644 --- a/tests/integration/gcp_compute_http_health_check/tasks/main.yml +++ b/tests/integration/gcp_compute_http_health_check/tasks/main.yml @@ -91,7 +91,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that http_health_check was deleted gcp_compute_http_health_check_facts: filters: @@ -123,4 +122,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_https_health_check/tasks/main.yml b/tests/integration/gcp_compute_https_health_check/tasks/main.yml index a55de21..8aabb0b 100644 --- a/tests/integration/gcp_compute_https_health_check/tasks/main.yml +++ b/tests/integration/gcp_compute_https_health_check/tasks/main.yml @@ -91,7 +91,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that https_health_check was deleted gcp_compute_https_health_check_facts: filters: @@ -123,4 +122,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_image/tasks/main.yml b/tests/integration/gcp_compute_image/tasks/main.yml index 8b0dd41..6ddc818 100644 --- a/tests/integration/gcp_compute_image/tasks/main.yml +++ b/tests/integration/gcp_compute_image/tasks/main.yml @@ -88,7 +88,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that image was deleted gcp_compute_image_facts: filters: @@ -117,7 +116,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_instance/tasks/main.yml b/tests/integration/gcp_compute_instance/tasks/main.yml index 131f718..baf5442 100644 --- a/tests/integration/gcp_compute_instance/tasks/main.yml +++ b/tests/integration/gcp_compute_instance/tasks/main.yml @@ -172,7 +172,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that instance was deleted gcp_compute_instance_facts: filters: @@ -218,7 +217,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_instance_group/tasks/main.yml b/tests/integration/gcp_compute_instance_group/tasks/main.yml index cab05f1..0ac5d42 100644 --- a/tests/integration/gcp_compute_instance_group/tasks/main.yml +++ b/tests/integration/gcp_compute_instance_group/tasks/main.yml @@ -104,7 +104,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that instance_group was deleted gcp_compute_instance_group_facts: filters: @@ -138,7 +137,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_instance_group_manager/tasks/main.yml b/tests/integration/gcp_compute_instance_group_manager/tasks/main.yml index da43884..961b079 100644 --- a/tests/integration/gcp_compute_instance_group_manager/tasks/main.yml +++ b/tests/integration/gcp_compute_instance_group_manager/tasks/main.yml @@ -130,7 +130,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that instance_group_manager was deleted gcp_compute_instance_group_manager_facts: filters: @@ -163,7 +162,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_instance_template/tasks/main.yml b/tests/integration/gcp_compute_instance_template/tasks/main.yml index 9482b0e..6d0fcf4 100644 --- a/tests/integration/gcp_compute_instance_template/tasks/main.yml +++ b/tests/integration/gcp_compute_instance_template/tasks/main.yml @@ -144,7 +144,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that instance_template was deleted gcp_compute_instance_template_facts: filters: @@ -185,7 +184,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_network/tasks/main.yml b/tests/integration/gcp_compute_network/tasks/main.yml index d8cb927..a20f358 100644 --- a/tests/integration/gcp_compute_network/tasks/main.yml +++ b/tests/integration/gcp_compute_network/tasks/main.yml @@ -79,7 +79,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that network was deleted gcp_compute_network_facts: filters: @@ -108,4 +107,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_region_disk/tasks/main.yml b/tests/integration/gcp_compute_region_disk/tasks/main.yml index e18f124..1619316 100644 --- a/tests/integration/gcp_compute_region_disk/tasks/main.yml +++ b/tests/integration/gcp_compute_region_disk/tasks/main.yml @@ -104,7 +104,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that region_disk was deleted gcp_compute_region_disk_facts: filters: @@ -140,4 +139,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_route/tasks/main.yml b/tests/integration/gcp_compute_route/tasks/main.yml index 1b9b28b..dbf5540 100644 --- a/tests/integration/gcp_compute_route/tasks/main.yml +++ b/tests/integration/gcp_compute_route/tasks/main.yml @@ -107,7 +107,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that route was deleted gcp_compute_route_facts: filters: @@ -141,7 +140,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_router/tasks/main.yml b/tests/integration/gcp_compute_router/tasks/main.yml index 2e20dd9..eb4f89f 100644 --- a/tests/integration/gcp_compute_router/tasks/main.yml +++ b/tests/integration/gcp_compute_router/tasks/main.yml @@ -124,7 +124,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that router was deleted gcp_compute_router_facts: filters: @@ -163,7 +162,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_ssl_certificate/tasks/main.yml b/tests/integration/gcp_compute_ssl_certificate/tasks/main.yml index afa6971..3434494 100644 --- a/tests/integration/gcp_compute_ssl_certificate/tasks/main.yml +++ b/tests/integration/gcp_compute_ssl_certificate/tasks/main.yml @@ -127,7 +127,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that ssl_certificate was deleted gcp_compute_ssl_certificate_facts: filters: @@ -168,4 +167,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_ssl_policy/tasks/main.yml b/tests/integration/gcp_compute_ssl_policy/tasks/main.yml index 01332bb..4073a31 100644 --- a/tests/integration/gcp_compute_ssl_policy/tasks/main.yml +++ b/tests/integration/gcp_compute_ssl_policy/tasks/main.yml @@ -95,7 +95,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that ssl_policy was deleted gcp_compute_ssl_policy_facts: filters: @@ -128,4 +127,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_subnetwork/tasks/main.yml b/tests/integration/gcp_compute_subnetwork/tasks/main.yml index 587008b..6a865a7 100644 --- a/tests/integration/gcp_compute_subnetwork/tasks/main.yml +++ b/tests/integration/gcp_compute_subnetwork/tasks/main.yml @@ -97,7 +97,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that subnetwork was deleted gcp_compute_subnetwork_facts: filters: @@ -129,7 +128,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_target_http_proxy/tasks/main.yml b/tests/integration/gcp_compute_target_http_proxy/tasks/main.yml index 1461073..761b298 100644 --- a/tests/integration/gcp_compute_target_http_proxy/tasks/main.yml +++ b/tests/integration/gcp_compute_target_http_proxy/tasks/main.yml @@ -122,7 +122,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that target_http_proxy was deleted gcp_compute_target_http_proxy_facts: filters: @@ -151,7 +150,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_target_https_proxy/tasks/main.yml b/tests/integration/gcp_compute_target_https_proxy/tasks/main.yml index 41e6f58..d72bb2a 100644 --- a/tests/integration/gcp_compute_target_https_proxy/tasks/main.yml +++ b/tests/integration/gcp_compute_target_https_proxy/tasks/main.yml @@ -151,7 +151,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that target_https_proxy was deleted gcp_compute_target_https_proxy_facts: filters: @@ -182,7 +181,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_target_pool/tasks/main.yml b/tests/integration/gcp_compute_target_pool/tasks/main.yml index 35cc575..fcc07bc 100644 --- a/tests/integration/gcp_compute_target_pool/tasks/main.yml +++ b/tests/integration/gcp_compute_target_pool/tasks/main.yml @@ -80,7 +80,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that target_pool was deleted gcp_compute_target_pool_facts: filters: @@ -110,4 +109,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_compute_target_ssl_proxy/tasks/main.yml b/tests/integration/gcp_compute_target_ssl_proxy/tasks/main.yml index dacc8b7..c4c9727 100644 --- a/tests/integration/gcp_compute_target_ssl_proxy/tasks/main.yml +++ b/tests/integration/gcp_compute_target_ssl_proxy/tasks/main.yml @@ -146,7 +146,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that target_ssl_proxy was deleted gcp_compute_target_ssl_proxy_facts: filters: @@ -177,7 +176,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_target_tcp_proxy/tasks/main.yml b/tests/integration/gcp_compute_target_tcp_proxy/tasks/main.yml index 9c0713c..bf531bd 100644 --- a/tests/integration/gcp_compute_target_tcp_proxy/tasks/main.yml +++ b/tests/integration/gcp_compute_target_tcp_proxy/tasks/main.yml @@ -121,7 +121,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that target_tcp_proxy was deleted gcp_compute_target_tcp_proxy_facts: filters: @@ -151,7 +150,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_target_vpn_gateway/tasks/main.yml b/tests/integration/gcp_compute_target_vpn_gateway/tasks/main.yml index 2345222..5db4472 100644 --- a/tests/integration/gcp_compute_target_vpn_gateway/tasks/main.yml +++ b/tests/integration/gcp_compute_target_vpn_gateway/tasks/main.yml @@ -101,7 +101,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that target_vpn_gateway was deleted gcp_compute_target_vpn_gateway_facts: filters: @@ -132,7 +131,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_url_map/tasks/main.yml b/tests/integration/gcp_compute_url_map/tasks/main.yml index e359dd7..7d8d45a 100644 --- a/tests/integration/gcp_compute_url_map/tasks/main.yml +++ b/tests/integration/gcp_compute_url_map/tasks/main.yml @@ -113,7 +113,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that url_map was deleted gcp_compute_url_map_facts: filters: @@ -142,7 +141,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_compute_vpn_tunnel/tasks/main.yml b/tests/integration/gcp_compute_vpn_tunnel/tasks/main.yml index 9e9db55..b13d306 100644 --- a/tests/integration/gcp_compute_vpn_tunnel/tasks/main.yml +++ b/tests/integration/gcp_compute_vpn_tunnel/tasks/main.yml @@ -128,7 +128,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that vpn_tunnel was deleted gcp_compute_vpn_tunnel_facts: filters: @@ -161,7 +160,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_dns_managed_zone/tasks/main.yml b/tests/integration/gcp_dns_managed_zone/tasks/main.yml index e274a38..3b6c1d6 100644 --- a/tests/integration/gcp_dns_managed_zone/tasks/main.yml +++ b/tests/integration/gcp_dns_managed_zone/tasks/main.yml @@ -82,7 +82,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that managed_zone was deleted gcp_dns_managed_zone_facts: dns_name: test.somewild2.example.com. @@ -111,4 +110,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_dns_resource_record_set/tasks/main.yml b/tests/integration/gcp_dns_resource_record_set/tasks/main.yml index 9128d5a..cccacb6 100644 --- a/tests/integration/gcp_dns_resource_record_set/tasks/main.yml +++ b/tests/integration/gcp_dns_resource_record_set/tasks/main.yml @@ -108,7 +108,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that resource_record_set was deleted gcp_dns_resource_record_set_facts: managed_zone: "{{ managed_zone }}" @@ -141,7 +140,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_iam_service_account/defaults/main.yml b/tests/integration/gcp_iam_service_account/defaults/main.yml index 5595dfb..ba66644 100644 --- a/tests/integration/gcp_iam_service_account/defaults/main.yml +++ b/tests/integration/gcp_iam_service_account/defaults/main.yml @@ -1,3 +1,2 @@ --- resource_name: "{{ resource_prefix }}" -sa_name: sa-{{ 100000 | random }}@graphite-playground.google.com.iam.gserviceaccount.com diff --git a/tests/integration/gcp_iam_service_account/tasks/main.yml b/tests/integration/gcp_iam_service_account/tasks/main.yml index aa6dab3..ec1ae99 100644 --- a/tests/integration/gcp_iam_service_account/tasks/main.yml +++ b/tests/integration/gcp_iam_service_account/tasks/main.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a service account gcp_iam_service_account: - name: "{{ sa_name }}" + name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -24,7 +24,7 @@ #---------------------------------------------------------- - name: create a service account gcp_iam_service_account: - name: "{{ sa_name }}" + name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -46,11 +46,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*{{ sa_name }}.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a service account that already exists gcp_iam_service_account: - name: "{{ sa_name }}" + name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -64,7 +64,7 @@ #---------------------------------------------------------- - name: delete a service account gcp_iam_service_account: - name: "{{ sa_name }}" + name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -86,11 +86,11 @@ - name: verify that command succeeded assert: that: - - results['resources'] | map(attribute='name') | select("match", ".*{{ sa_name }}.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a service account that does not exist gcp_iam_service_account: - name: "{{ sa_name }}" + name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" diff --git a/tests/integration/gcp_sql_database/tasks/main.yml b/tests/integration/gcp_sql_database/tasks/main.yml index 6c9f732..9b300ad 100644 --- a/tests/integration/gcp_sql_database/tasks/main.yml +++ b/tests/integration/gcp_sql_database/tasks/main.yml @@ -97,7 +97,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that database was deleted gcp_sql_database_facts: instance: "{{ instance }}" @@ -126,7 +125,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_sql_instance/tasks/main.yml b/tests/integration/gcp_sql_instance/tasks/main.yml index 0bee3e3..96aa398 100644 --- a/tests/integration/gcp_sql_instance/tasks/main.yml +++ b/tests/integration/gcp_sql_instance/tasks/main.yml @@ -101,7 +101,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that instance was deleted gcp_sql_instance_facts: project: "{{ gcp_project }}" @@ -134,4 +133,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_sql_user/tasks/main.yml b/tests/integration/gcp_sql_user/tasks/main.yml index ec342de..78e1005 100644 --- a/tests/integration/gcp_sql_user/tasks/main.yml +++ b/tests/integration/gcp_sql_user/tasks/main.yml @@ -101,7 +101,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False - name: verify that user was deleted gcp_sql_user_facts: instance: "{{ instance }}" @@ -131,7 +130,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! diff --git a/tests/integration/gcp_storage_bucket/tasks/main.yml b/tests/integration/gcp_storage_bucket/tasks/main.yml index 1f3fe22..dcf45d5 100644 --- a/tests/integration/gcp_storage_bucket/tasks/main.yml +++ b/tests/integration/gcp_storage_bucket/tasks/main.yml @@ -61,7 +61,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False # ---------------------------------------------------------------------------- - name: delete a bucket that does not exist gcp_storage_bucket: @@ -75,4 +74,3 @@ assert: that: - result.changed == false - - result.has_key('kind') == False diff --git a/tests/integration/gcp_storage_bucket_access_control/tasks/main.yml b/tests/integration/gcp_storage_bucket_access_control/tasks/main.yml index 52c63b6..c37b439 100644 --- a/tests/integration/gcp_storage_bucket_access_control/tasks/main.yml +++ b/tests/integration/gcp_storage_bucket_access_control/tasks/main.yml @@ -77,7 +77,6 @@ assert: that: - result.changed == true - - result.has_key('kind') == False # ---------------------------------------------------------------------------- - name: delete a bucket access control that does not exist gcp_storage_bucket_access_control: @@ -93,7 +92,6 @@ assert: that: - result.changed == false - - result.has_key('kind') == False #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook!