I am trying to create a cloudsql instance with Private IP address as there is organization constraint for configuring Public IP on Cloud SQL instances. The VPC network of my project is not a shared one . I am getting error when i run gcloud command to create the sql instance when i specify the network . Error : NETWORK_NOT_PEERED While not specifying the network i get the error : At least one of Public IP or Private IP or PSC connectivity must be enabled.. Please help how to create the instance
While using the Cloud console,GCP automatically creates the private service connection and sets up peering between the customer's VPC and the internal Google VPC. But this is not the case when using gcloud/terraform (command line tools). Because of this you are facing Error : NETWORK_NOT_PEERED.
To resolve your issue, you need to create the private service connection manually, and then the instance creation gets successfully completed as shown in the below screenshot.
Creating a cloud SQL instance using gcloud or any other manual method must create the private service connection manually before triggering the instance creation event.