Skip to content

Instantly share code, notes, and snippets.

@davidalger
Created February 2, 2021 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidalger/a8f25d6a888b3444cbc2e2f08f03fc91 to your computer and use it in GitHub Desktop.
Save davidalger/a8f25d6a888b3444cbc2e2f08f03fc91 to your computer and use it in GitHub Desktop.
GCP Asset Inventory
PS1='$ ' && clear
GCP_PROJECT=my-first-project \
&& gcloud services enable cloudasset.googleapis.com --project "${GCP_PROJECT}" \
&& echo Waiting for API enablement to propagate \
&& utimer -c 2m \
&& gcloud asset search-all-resources --scope "projects/${GCP_PROJECT}" --sort-by 'assetType' \
--format='table(assetType.basename(), name.basename(), name.scope(projects).segment(0):label=PROJECT_ID, labels)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment