diff --git a/plugins/modules/gcp_compute_ssl_certificate.py b/plugins/modules/gcp_compute_ssl_certificate.py index 5d0ef0f..15ddaba 100644 --- a/plugins/modules/gcp_compute_ssl_certificate.py +++ b/plugins/modules/gcp_compute_ssl_certificate.py @@ -133,7 +133,6 @@ EXAMPLES = ''' - name: create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: test_object - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- diff --git a/plugins/modules/gcp_resourcemanager_project.py b/plugins/modules/gcp_resourcemanager_project.py index 41664bf..9cae5f0 100644 --- a/plugins/modules/gcp_resourcemanager_project.py +++ b/plugins/modules/gcp_resourcemanager_project.py @@ -134,7 +134,7 @@ EXAMPLES = ''' - name: create a project google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" parent: diff --git a/scripts/bootstrap-project.sh b/scripts/bootstrap-project.sh index 0bce608..924d713 100755 --- a/scripts/bootstrap-project.sh +++ b/scripts/bootstrap-project.sh @@ -21,6 +21,7 @@ SERVICE_LIST=( "dns" "file.googleapis.com" "ml.googleapis.com" + "redis.googleapis.com" "runtimeconfig.googleapis.com" "sourcerepo.googleapis.com" "spanner.googleapis.com" diff --git a/tests/integration/targets/gcp_compute_forwarding_rule/aliases b/tests/integration/targets/gcp_compute_forwarding_rule/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_forwarding_rule/aliases +++ b/tests/integration/targets/gcp_compute_forwarding_rule/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases b/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases index 0e4419e..ff7eb2d 100644 --- a/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases +++ b/tests/integration/targets/gcp_compute_global_forwarding_rule/aliases @@ -1 +1,2 @@ -cloud/gcp \ No newline at end of file +cloud/gcp +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/aliases b/tests/integration/targets/gcp_compute_ssl_certificate/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/aliases +++ b/tests/integration/targets/gcp_compute_ssl_certificate/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml index 911bc63..a8346cd 100644 --- a/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_ssl_certificate/tasks/autogen.yml @@ -16,7 +16,6 @@ - name: delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- @@ -50,7 +49,6 @@ - name: create a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- @@ -103,7 +101,6 @@ - name: create a SSL certificate that already exists google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- @@ -142,7 +139,6 @@ - name: delete a SSL certificate google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- @@ -195,7 +191,6 @@ - name: delete a SSL certificate that does not exist google.cloud.gcp_compute_ssl_certificate: name: "{{ resource_name }}" - region: us-central1 description: A certificate for testing. Do not use this certificate in production certificate: |- -----BEGIN CERTIFICATE----- diff --git a/tests/integration/targets/gcp_iam_service_account/aliases b/tests/integration/targets/gcp_iam_service_account/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_iam_service_account/aliases +++ b/tests/integration/targets/gcp_iam_service_account/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml index 9c70ab3..e511e99 100644 --- a/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml +++ b/tests/integration/targets/gcp_iam_service_account/tasks/autogen.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a service account google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.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 google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.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-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 1 + - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 1 # ---------------------------------------------------------------------------- - name: create a service account that already exists google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.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 google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.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-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com.*") | list | length == 0 + - results['resources'] | map(attribute='name') | select("match", ".*sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com.*") | list | length == 0 # ---------------------------------------------------------------------------- - name: delete a service account that does not exist google.cloud.gcp_iam_service_account: - name: sa-{{ resource_name.split("-")[-1] }}@graphite-playground.google.com.iam.gserviceaccount.com + name: sa-{{ resource_name.split("-")[-1] }}@{{ gcp_project }}.iam.gserviceaccount.com display_name: My Ansible test key project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" diff --git a/tests/integration/targets/gcp_kms_key_ring/aliases b/tests/integration/targets/gcp_kms_key_ring/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_kms_key_ring/aliases +++ b/tests/integration/targets/gcp_kms_key_ring/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_mlengine_version/aliases b/tests/integration/targets/gcp_mlengine_version/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_mlengine_version/aliases +++ b/tests/integration/targets/gcp_mlengine_version/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_redis_instance/aliases b/tests/integration/targets/gcp_redis_instance/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_redis_instance/aliases +++ b/tests/integration/targets/gcp_redis_instance/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml index 3580c1a..9980558 100644 --- a/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml +++ b/tests/integration/targets/gcp_redis_instance/tasks/autogen.yml @@ -19,6 +19,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: present register: network - name: delete a instance @@ -165,6 +166,7 @@ project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + auto_create_subnetworks: true state: absent register: network ignore_errors: true diff --git a/tests/integration/targets/gcp_resourcemanager_project/aliases b/tests/integration/targets/gcp_resourcemanager_project/aliases index 9812f01..ff7eb2d 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/aliases +++ b/tests/integration/targets/gcp_resourcemanager_project/aliases @@ -1,2 +1,2 @@ cloud/gcp -unsupported +unsupported \ No newline at end of file diff --git a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml index 81043b0..5e02c41 100644 --- a/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml +++ b/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml @@ -16,7 +16,7 @@ - name: delete a project google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: @@ -27,7 +27,7 @@ - name: create a project google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: @@ -55,7 +55,7 @@ - name: create a project that already exists google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: @@ -71,7 +71,7 @@ - name: delete a project google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: @@ -99,7 +99,7 @@ - name: delete a project that does not exist google.cloud.gcp_resourcemanager_project: name: My Sample Project - id: alextest-{{ 10000000000 | random }} + id: ansible-test-{{ 10000000000 | random }} auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" parent: diff --git a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml index 473a198..6db1573 100644 --- a/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml +++ b/tests/integration/targets/gcp_serviceusage_service/tasks/autogen.yml @@ -71,6 +71,11 @@ assert: that: - result.changed == true +# TODO(@toumorokoshi): investigate if the pause helps +# prevent quota issues. +# - name: Pause for 1 minute to keep from hitting quota limit +# ansible.builtin.pause: +# minutes: 1 - name: verify that service was deleted google.cloud.gcp_serviceusage_service_info: project: "{{ gcp_project }}" diff --git a/tests/integration/targets/gcp_spanner_instance/aliases b/tests/integration/targets/gcp_spanner_instance/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_spanner_instance/aliases +++ b/tests/integration/targets/gcp_spanner_instance/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_storage_bucket/aliases b/tests/integration/targets/gcp_storage_bucket/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_storage_bucket/aliases +++ b/tests/integration/targets/gcp_storage_bucket/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_storage_bucket/defaults/main.yml b/tests/integration/targets/gcp_storage_bucket/defaults/main.yml index ba66644..10f1ec1 100644 --- a/tests/integration/targets/gcp_storage_bucket/defaults/main.yml +++ b/tests/integration/targets/gcp_storage_bucket/defaults/main.yml @@ -1,2 +1,2 @@ --- -resource_name: "{{ resource_prefix }}" +resource_name: "{{ gcp_project }}-ansible-test-bucket" diff --git a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml index c82302e..b6d83e4 100644 --- a/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml +++ b/tests/integration/targets/gcp_storage_bucket/tasks/autogen.yml @@ -15,7 +15,7 @@ # Pre-test setup - name: delete a bucket google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -23,7 +23,7 @@ #---------------------------------------------------------- - name: create a bucket google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -36,7 +36,7 @@ # ---------------------------------------------------------------------------- - name: create a bucket that already exists google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -49,7 +49,7 @@ #---------------------------------------------------------- - name: delete a bucket google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -62,7 +62,7 @@ # ---------------------------------------------------------------------------- - name: delete a bucket that does not exist google.cloud.gcp_storage_bucket: - name: ansible-storage-module + name: "{{ resource_name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/tests/integration/targets/gcp_tpu_node/aliases b/tests/integration/targets/gcp_tpu_node/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_tpu_node/aliases +++ b/tests/integration/targets/gcp_tpu_node/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml index 4f00836..e44d632 100644 --- a/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml +++ b/tests/integration/targets/gcp_tpu_node/tasks/autogen.yml @@ -16,9 +16,9 @@ - name: delete a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + zone: us-central1-a + accelerator_type: "v2-32" + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -28,9 +28,9 @@ - name: create a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + zone: us-central1-a + accelerator_type: "v2-32" + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -43,7 +43,7 @@ - result.changed == true - name: verify that node was created google.cloud.gcp_tpu_node_info: - zone: us-central1-b + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -58,9 +58,9 @@ - name: create a node that already exists google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + zone: us-central1-a + accelerator_type: "v2-32" + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -75,9 +75,9 @@ - name: delete a node google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + zone: us-central1-a + accelerator_type: "v2-32" + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -90,7 +90,7 @@ - result.changed == true - name: verify that node was deleted google.cloud.gcp_tpu_node_info: - zone: us-central1-b + zone: us-central1-a project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -105,9 +105,9 @@ - name: delete a node that does not exist google.cloud.gcp_tpu_node: name: "{{ resource_name }}" - zone: us-central1-b - accelerator_type: v3-8 - tensorflow_version: '1.11' + zone: us-central1-a + accelerator_type: "v2-32" + tensorflow_version: '2.10.0' cidr_block: 10.2.0.0/29 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}"