4

When trying to delete the default network from a google cloud project using the following command: gcloud compute networks delete default

The following error is returned:

`ERROR: (gcloud.compute.networks.delete) Could not fetch resource:
 - The network resource 'projects/<PROJECT-NAME>/global/networks/default' 
is already being used by 'projects/<PROJECT-NAME>/global/addresses/google- 
managed-services-default'`

How can this be resolved?

2 Answers 2

4

I too ran into this problem:

$ gcloud compute addresses list
NAME                                 ADDRESS/RANGE  TYPE      PURPOSE      NETWORK      REGION  SUBNET  STATUS
google-managed-services-test  10.21.96.0/20  INTERNAL  VPC_PEERING  test                  RESERVED

But the CLI would select the wrong region when deleting:

$ gcloud compute addresses delete google-managed-services-test
The following addresses will be deleted:
 - [google-managed-services-test] in [us-central1]

Do you want to continue (Y/n)?  Y

ERROR: (gcloud.compute.addresses.delete) Could not fetch resource:
 - The resource 'projects/magic-test/regions/us-central1/addresses/google-managed-services-test' was not found

The solution was to add the --global flag to the delete command:

$ gcloud compute addresses delete --global google-managed-services-test
The following global addresses will be deleted:
 - [google-managed-services-test]

Do you want to continue (Y/n)?  Y

Deleted [https://www.googleapis.com/compute/v1/projects/magic-test/global/addresses/google-managed-services-test].
1

My bad gcloud compute addresses list revealed the the resource and gcloud compute addresses delete google-managed-services-default deleted it

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .