resource "google_compute_network" "vpc" { name = "rarelens-vpc" auto_create_subnetworks = false depends_on = [google_project_service.enabled] } # Shared by GKE and the Google Batch VMs that run pipeline tasks (pipeline/nextflow.config). resource "google_compute_subnetwork" "gke" { name = "rarelens-gke" region = var.region network = google_compute_network.vpc.id ip_cidr_range = "10.10.0.0/20" private_ip_google_access = true } # Private services access, so Cloud SQL gets a private IP inside this VPC. Only needed with it. resource "google_compute_global_address" "private_services" { count = var.deploy_cloud_sql ? 1 : 0 name = "rarelens-private-services" purpose = "VPC_PEERING" address_type = "INTERNAL" prefix_length = 16 network = google_compute_network.vpc.id } resource "google_service_networking_connection" "private_services" { count = var.deploy_cloud_sql ? 1 : 0 network = google_compute_network.vpc.id service = "servicenetworking.googleapis.com" reserved_peering_ranges = [google_compute_global_address.private_services[0].name] }