How to enable private google access in all subnets of a VPC

Viewed 192
1 Answers

Use bash to list all subnets then pipe them into the update command:

gcloud compute networks subnets list --filter=<your_vpc> --format="get(REGION)" | awk -F/ '{print $NF}' | xargs -I {} gcloud compute networks subnets update <your_vpc> --region={} --enable-private-ip-google-access
Related