8

How do I take a full resource name, such as projects/<project_id>/global/networkInstances/<instance_id>, and find out more about it with just that information?

I am currently trying to delete the default network from one of my existing GCP projects. running gcloud compute networks delete --quiet default resulted in this error:

- The network resource 'projects/<project_id>/global/networks/default' 
is already being used by 'projects/<project_id>/global/networkInstances/<instance_id>'

I've looked everywhere I can think of, and I cannot find any resources within the default network, so I'm hoping I can use this resource name to learn more about it.

7
  • I have the same question. Did you eventually find the answer?
    – ahong
    Jul 16, 2020 at 8:48
  • I did not. I don't think it's possible.
    – DragonBobZ
    Jul 16, 2020 at 15:16
  • Too bad. So the network is just sitting around now?
    – ahong
    Jul 17, 2020 at 4:15
  • I eventually found and deleted the offending resource, but the full resource name was not helpful in doing so.
    – DragonBobZ
    Jul 17, 2020 at 16:27
  • Can you give a hint on what type of resource it is? I think I've pretty much deleted everything.
    – ahong
    Jul 17, 2020 at 16:50

6 Answers 6

4

For my case, I had a Cloud Run service connected to the VPC network. I deleted the "Serverless VPC Access connector" allowing Cloud Run to connect, which probably should not be allowed because a Cloud Run service/version was still referencing the connector, therefore "using" the VPC network also.

tl;dr once I deleted the Cloud Run service, I was able to delete the VPC network. This was probably the projects/<project_id>/global/networkInstances/<instance_id> the error message was referring to.

1
  • 1
    Worked for me. I had the same problem. Thanks! Sep 14, 2022 at 4:30
1

As per my understanding VPC network consists of:

  1. Subnets
  2. Static Internal IP addresses
  3. Firewall rules
  4. Routes (including static and routes created automatically/dynamically)
  5. VPC network Peering
  6. Private Service connection
  7. Instances

On of the prerequisite of deleting VPC network is, you must delete all resources in all of its subnets, and all resources that reference the network. Resources that reference the network include Cloud VPN gateways, Cloud Routers, firewall rules, and custom static routes.

I would recommand deleting any manually added configuration ( Custom static routes, VPC peering, Private service connections etc) for that VPC network before trying deleting it.

1

Like userX said you need to delete all of below resources referring to that VPC But there is another things -

  1. Subnets
  2. Static Internal IP addresses
  3. Firewall rules
  4. Routes
  5. VPC network Peering
  6. Private Service connection
  7. Instances

So if you confirms that error is not because of above 1 to 7 items, Then check if you have any

  1. Cloud Run
  2. Cloud Task
  3. App Engine service with redis cache implementation

In my case problem was because of App engine (standard) Java service which was reffering to deleted redis cache which needs serverless VPC and serverless VPC needs VPC. Even though serverless VPC, Redis instance was deleted that app engine instace was not allowing me to delete VPC.

So just try that as well.

1
  • If you have ever used the App Engine default service in a GCP project, you cannot delete the VPC network. App Engine creates "invisible" infrastructure to run, and since you cannot delete the default App Engine service, you cannot delete the hidden resources, and therefore you cannot delete the VPC network. Aug 25, 2021 at 14:50
0

I had this happen to me

In my case, it was related to a shared VPC (service project) connected to my host VPC. I had deleted my service project, but was unable to delete the VPC on the host project.

Turns out, upon deletion some resources go in to a frozen state for 30 days, and are still using the VPC, and would not allow me to delete.

What worked at the end, was to re-enable the project, and then I deleted the resources, detached the service project, from the host. This worked for.

Here is the official GCP documentation on this.

0

In my case, I was trying to update my shared vpc network in the host shared vpc project. I faced to that error 'Invalid resource usage: 'The resource 'projects/project_name/global/networkInstances/v-1212313....' is still linked to shared VPC host' /projects/other-project.

I have followed these steps:

Firstly, I deleted all vm instances and resource in the shared vpc subnets. Secondly, I attempted to delete that project in attached project list which is host shared vpc project.

I received that error again: 'The resource 'projects/project_name/global/networkInstances/v-1212313....' is still linked to shared VPC host'

After all, I double-checked my all resources in my shared vpc project(that is not host shared vpc project.). I found a function that is working shared vpc network. And I set its the subnet to None. I had re-deployed

This is how I fixed my problem. Whoever is dealing with that issue, in my opinion, should verify all resources(cloud run, clound functions, vms and vpc connector, static ip address etc. ) which should not be use shared vpc subnets.

0

At first check for the resources which uses the default network. For example : 1.Shared vpc . 2. cloud functions In cloud function we can change the network from default to new . Then try deleting the Default network it will work.

This site is temporarily in read-only mode and not accepting new answers.

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