In Google Cloud Platform (GCP), you can use list APIs or commands to list resources in a given project for a given type in a given service, like BigQuery datasets or compute instances.
But how to find or search resources across types, services, or even projects?
You can use search-all-resources to search all the resources across services (or APIs) and projects for a given organization, folder, or project.
To search all the resources in a project with number 123:
$ gcloud asset search-all-resources --scope=projects/123
To limit to only compute resources:
$ gcloud asset search-all-resources --scope=projects/123 --query="compute.googleapis.com"
To limit to only resources containing "foo" as a sub string:
$ gcloud asset search-all-resources --scope=projects/123 --query="*foo*"
To list all the projects within an organization 456:
$ gcloud asset search-all-resources --scope=organizations/456 --asset-types=cloudresourcemanager.googleapis.com/Project
To find all the BigQuery datasets containing "foo" as a sub string within an organization 456:
$ gcloud asset search-all-resources --scope=organizations/456 --query="bigquery datasets *foo*"
You can set the scope to a project, a folder or an organization.
To use the command, you must:
Enable Cloud Asset API, and
Have cloudasset.assets.searchAllResources
permission upon the scope, which is included in these roles:
Documentation: