0

Deleting deployment will fail if there's the resource in Deployment is used by another custom resource. I.e. Newly created Firewall linked to VPC deployment will prevent the deployment deletion process and therefore will causing error, with informative error message:

mynetwork has resource level errors

mynetwork:{"ResourceType":"compute.v1.network","ResourceErrorCode":"RESOURCE_IN_USE_BY_ANOTHER_RESOURCE","ResourceErrorMessage":"The network resource 'projects/myproject/global/networks/mynetwork' is already being used by 'projects/myproject/global/firewalls/mycustomfirewall'"}

To prevent this case, is there any way to get that kind of messages before actually deleting it?

purnadika
  • 101
  • 4

1 Answers1

0

In this link you will find how to list all deployments for a given project. By adding the parameters you can find in the documentation, you could retrieve information that may be useful to determine the use other resources in the deployment.

I also attach you the CLI command for have a better wrasp on its use.

Nahuel
  • 3
  • 2
  • Our system currently using that approach. By checking the most often used GCP resources and compare to deployments. But I'm afraid if user would add other type of GCP resources and linked to the network. This will cause above error. Well that might be the worst case. I just hope there's an API from GCP that directly check resources dependencies – purnadika Jul 05 '21 at 09:18