mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-09 06:40:09 -07:00
tests: fix gcp_compute_vpn_tunnel
- vpn_gateway required minimal changes (stop using legacy load balancers) - compute_vpn_tunnel requires a valid vpn configuration (several dependent forwarding rules and configuration to set up a proper tunnel).
This commit is contained in:
parent
54c14b66f6
commit
ebf095d22d
6 changed files with 229 additions and 14 deletions
|
@ -14,10 +14,16 @@ ZONE="us-central1-a"
|
|||
main() {
|
||||
# note: the ordering here is deliberate, to start with
|
||||
# leaf resources and work upwards to parent resources.
|
||||
cleanup_resource_per_region "compute vpn-tunnels"
|
||||
cleanup_resource "compute instances" "" "--zone=$ZONE"
|
||||
cleanup_resource_per_region "compute addresses"
|
||||
cleanup_resource "compute target-http-proxies" "" "--global"
|
||||
cleanup_resource "compute forwarding-rules" "" "--global"
|
||||
cleanup_resource "compute url-maps" "" "--global"
|
||||
cleanup_resource "compute forwarding-rules" "--global" "--global"
|
||||
cleanup_resource "compute forwarding-rules" \
|
||||
"--regions=us-central1" "--region=us-central1"
|
||||
cleanup_resource "compute url-maps" "--global" "--global"
|
||||
cleanup_resource "compute url-maps" \
|
||||
"--regions=us-central1" "--region=us-central1"
|
||||
cleanup_resource "compute backend-services" "--global" "--global"
|
||||
cleanup_resource "compute backend-services" \
|
||||
"--regions=us-central1" "--region=us-central1"
|
||||
|
@ -33,4 +39,12 @@ cleanup_resource() {
|
|||
done
|
||||
}
|
||||
|
||||
cleanup_resource_per_region() {
|
||||
resource_group="$1"
|
||||
for resource_and_region in $(gcloud $resource_group list --project="${PROJECT_ID}" --format="csv[no-heading](name,region)"); do
|
||||
read -r resource region < <(echo "$resource_and_region" | tr "," " ")
|
||||
gcloud $resource_group delete "${resource}" --project="${PROJECT_ID}" -q --region="${region}"
|
||||
done
|
||||
}
|
||||
|
||||
main
|
Loading…
Add table
Add a link
Reference in a new issue