Problem
While creating or removing a private service connection, the below error was observed:
Cannot modify allocated ranges in CreateConnection. Please use UpdateConnection.
Environment
- VPC Networking
- Private Service Connection
Solution
To recreate the connection (once deleted), you have to use the gcloud command as mentioned below.
gcloud services vpc-peerings update --service=servicenetworking.googleapis.com --ranges=[Allocated_Range_Name] --network=[netowrk_name] --project=[project_id] --force
Cause
Creating a private connection is a one-time procedure. Generally this error generates, when you delete the previously created connection and allocated IP range and try recreating the new connection with previous allocated ranges.