Difference between ListAssets and SearchAllResources

386 Views Asked by At

I'm trying to list every resource in a given Google Cloud project.

I was using the SearchAllResources endpoint so far. I'm now struggling to list cloudfunctions.googleapis.com/CloudFunction resources.

This resource is supported by the search according to the documentation

By digging around I've found the ListAssets endpoint that seems to return cloud functions:

# This one returned one result
➜ gcloud asset list --project=my-project --asset-types cloudfunctions.googleapis.com/CloudFunction | grep assetType    
assetType: cloudfunctions.googleapis.com/CloudFunction

# No result here, even after waiting a couple of hours
➜ gcloud asset search-all-resources --scope=projects/cloudskiff-dev-elie --asset-types cloudfunctions.googleapis.com/CloudFunction | grep assetType 
Listed 0 items.

I also tried without filter on asset types but it does not change the problem, cloud functions resources are not returned by the search all endpoint. I have several difference when I compare the two outputs: diff

That's not clear for me what are the purpose of these two endpoints. I can't find any clarification in GCP documentation. Also I don't get why we do not retrieve same set of resources. Any ideas ?

0

There are 0 best solutions below