Member-only story
Retrieve Google cloud Network Subnet details across all the projects in an Organization
When you run the below gcloud command to retrieve primary subnet and secondary subnet ranges , it will not display in proper tabular format, meaning not all the rows in the output will have information on region , network , subnet and primary CIDR range, there will be lot of empty column values for the secondary ranges.
gcloud compute networks subnets list-usable
If at all you need this information in proper tabular format, you have to do filter and formats with that gcloud command . This blog post will help you to do that , so you can retrieve the subnets detail not across a single project , but all the projects under your org provided you have access to it.
Create a shell script to iterate through projects and collect the subnetwork data in json format
Iterate through the data using the below python script file and export the details to a csv file.