diff --git a/scripts/cleanup-project.sh b/scripts/cleanup-project.sh index 962cb87..15f2d38 100755 --- a/scripts/cleanup-project.sh +++ b/scripts/cleanup-project.sh @@ -14,18 +14,21 @@ ZONE="us-central1-a" main() { # note: the ordering here is deliberate, to start with # leaf resources and work upwards to parent resources. - cleanup_resource "compute instances" "--zone=$ZONE" - cleanup_resource "compute target-http-proxies" "--global" - cleanup_resource "compute forwarding-rules" "--global" - cleanup_resource "compute url-maps" "--global" - cleanup_resource "compute backend-services" "--global" + cleanup_resource "compute instances" "" "--zone=$ZONE" + cleanup_resource "compute target-http-proxies" "" "--global" + cleanup_resource "compute forwarding-rules" "" "--global" + cleanup_resource "compute url-maps" "" "--global" + cleanup_resource "compute backend-services" "--global" "--global" + cleanup_resource "compute backend-services" \ + "--regions=us-central1" "--region=us-central1" } cleanup_resource() { resource_group="$1" - extra_delete_args="$2" + extra_list_args="$2" + extra_delete_args="$3" - for resource in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name)"); do + for resource in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name)" $extra_list_args); do gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q $extra_delete_args done } diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/aliases b/tests/integration/targets/gcp_compute_region_target_http_proxy/aliases index 9812f01..0e4419e 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/aliases +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/aliases @@ -1,2 +1 @@ -cloud/gcp -unsupported +cloud/gcp \ No newline at end of file diff --git a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml index abb8447..9dcd753 100644 --- a/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml +++ b/tests/integration/targets/gcp_compute_region_target_http_proxy/tasks/autogen.yml @@ -13,43 +13,22 @@ # # ---------------------------------------------------------------------------- # Pre-test setup -- name: create a instance group - google.cloud.gcp_compute_instance_group: - name: instancegroup-targethttpproxy - 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 - google.cloud.gcp_compute_http_health_check: - name: httphealthcheck-targethttpproxy - 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 - google.cloud.gcp_compute_backend_service: + google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpproxy - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" + region: us-central1 enable_cdn: 'true' + protocol: HTTP project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" + load_balancing_scheme: "EXTERNAL" state: present register: backendservice - name: create a URL map - google.cloud.gcp_compute_url_map: + google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpproxy + region: us-central1 default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" @@ -159,49 +138,24 @@ # Post-test teardown # If errors happen, don't crash the playbook! - name: delete a URL map - google.cloud.gcp_compute_url_map: + google.cloud.gcp_compute_region_url_map: name: urlmap-targethttpproxy + region: us-central1 default_service: "{{ backendservice }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" state: absent - register: urlmap ignore_errors: true - name: delete a backend service - google.cloud.gcp_compute_backend_service: + google.cloud.gcp_compute_region_backend_service: name: backendservice-targethttpproxy - backends: - - group: "{{ instancegroup.selfLink }}" - health_checks: - - "{{ healthcheck.selfLink }}" + region: us-central1 enable_cdn: 'true' + protocol: HTTP 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 - google.cloud.gcp_compute_http_health_check: - name: httphealthcheck-targethttpproxy - 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 - google.cloud.gcp_compute_instance_group: - name: instancegroup-targethttpproxy - 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 + load_balancing_scheme: "EXTERNAL" + state: present + ignore_errors: true \ No newline at end of file