Skip to content

Instantly share code, notes, and snippets.

@Jojoooo1
Created October 31, 2023 19:17
Show Gist options
  • Save Jojoooo1/d24a29417c6c3527d0bd0cb86360c75c to your computer and use it in GitHub Desktop.
Save Jojoooo1/d24a29417c6c3527d0bd0cb86360c75c to your computer and use it in GitHub Desktop.
Google private services access for shared VPC
resource "google_compute_global_address" "gcp_private_service_access_address" {
project = var.project_id
name = "${local.vpc_name}-peering-gcp-private-service-access"
network = module.vpc.network_self_link
purpose = "VPC_PEERING"
address_type = "INTERNAL"
address = "10.100.0.0"
prefix_length = 16
}
resource "google_service_networking_connection" "gcp_private_vpc_connection" {
network = module.vpc.network_self_link
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.gcp_private_service_access_address.name]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment