Google Service Networking Connection
This page shows how to write Terraform for Service Networking Connection and write them securely.
google_service_networking_connection (Terraform)
The Connection in Service Networking can be configured in Terraform with the resource name google_service_networking_connection
. The following sections describe 5 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "google_service_networking_connection" "private_service_connections_production" {
network = module.vpc_shared_networks_production.vpc.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_service_connections_production.name]
}
resource "google_service_networking_connection" "private_vpc_conn_1" {
provider = google-beta
network = google_compute_network.private_network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_1.name]
resource "google_service_networking_connection" "private-vpc-db-connection" {
network = google_compute_network.zone53.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.sql-private-ip.name]
}
resource "google_service_networking_connection" "master-private-vpc-db-connection" {
network = google_compute_network.vpc-network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private-ip-address.name]
}
resource "google_service_networking_connection" "replica-private-vpc-db-connection" {
resource "google_service_networking_connection" "private_vpc_connection" {
network = var.network
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = var.reserved_peering_ranges
Parameters
Name of VPC network connected with service producers using VPC peering.
-
peering
optional computed - string -
reserved_peering_ranges
required - list of string
Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.
-
service
required - string
Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.
Explanation in Terraform Registry
Manages a private VPC connection with a GCP service provider. For more information see the official documentation and API.
Frequently asked questions
What is Google Service Networking Connection?
Google Service Networking Connection is a resource for Service Networking of Google Cloud Platform. Settings can be wrote in Terraform.
Where can I find the example code for the Google Service Networking Connection?
For Terraform, the doitintl/terraform-gcp-templates, indeni/cloudrail-knowledge and Sahay-ohikc/Laboratory source code examples are useful. See the Terraform Example section for further details.