Skip to content

Instantly share code, notes, and snippets.

@MikeJansen
Last active January 2, 2023 16:55
Show Gist options
  • Save MikeJansen/463561caec658848dff3c080a057ad53 to your computer and use it in GitHub Desktop.
Save MikeJansen/463561caec658848dff3c080a057ad53 to your computer and use it in GitHub Desktop.
List compute across GCP projects with status
for p in $(gcloud projects list --format json|yq -p=j '.[]|.projectId');
do
PRJ=$p gcloud compute instances list --format json --project $p |yq -p=j '.[]|[env(PRJ), .status, .name]|@csv';
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment