Reputation: 273
I am reviewing firewall rules and would like to identify the specific resources for which that firewall rule applies (i.e. the resources with the specified network tag). I know this can be seen in the console by clicking on the specific firewall rule, however, I would like to do this much faster with a gcloud command.
I've reviewed the documentation here but I can't seem to work out the command for how to simply list the resources with a specific network tags.
Upvotes: 3
Views: 2554
Reputation: 208
To search across projects in GCP organization:
gcloud asset search-all-resources --scope=organizations/<org number here> --query="networkTags:<insert network tag>"
Upvotes: 0
Reputation: 66
The gcloud tools make this search available via the --filter command line flag. The command below will list all compute instances in GCE with the specific network tag. DOCS: https://cloud.google.com/sdk/gcloud/reference/topic/filters
gcloud compute instances list --filter="tags.items=<insert network tag>"
Upvotes: 5