mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-27 23:21:31 -07:00
tests: fixing region_target_http_proxy
The backend_service resource was not regional, which is in invalid configuration for a regional proxy to depend on. Fixing up cleanup-script to better handle region/ global resources.
This commit is contained in:
parent
b6f694ed7e
commit
5fc619fbb7
3 changed files with 25 additions and 69 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue