Google Cloud Platform - Find Resource by Full Resource Name
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.
As per my understanding VPC network consists of:
- Subnets
- Static Internal IP addresses
- Firewall rules
- Routes (including static and routes created automatically/dynamically)
- VPC network Peering
- Private Service connection
- 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.
Like userX said you need to delete all of below resources referring to that VPC But there is another things -
- Subnets
- Static Internal IP addresses
- Firewall rules
- Routes
- VPC network Peering
- Private Service connection
- Instances
So if you confirms that error is not because of above 1 to 7 items, Then check if you have any
- Cloud Run
- Cloud Task
- 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.