Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save JamesAtIntegratnIO/9069b442ac1b20e359f36264fc35f8fa to your computer and use it in GitHub Desktop.

Select an option

Save JamesAtIntegratnIO/9069b442ac1b20e359f36264fc35f8fa to your computer and use it in GitHub Desktop.
List gcloud subnetworks with their secondary ranges to csv
gcloud compute networks subnets list-usable --flatten="secondaryIpRanges[]" \
--format="csv(
ipCidrRange:label=RANGE,
subnetwork.segment(-1):label=SUBNET_NAME,
secondaryIpRanges.ipCidrRange:label=SECONDARY_RANGE,
secondaryIpRanges.rangeName:label=Secondary_RANGE_NAME
)"
@JamesAtIntegratnIO
Copy link
Author

JamesAtIntegratnIO commented May 16, 2022

This needs improvements. Currently if a subnet does not have a secondary range, you will get a blank line of commas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment