Google Serverless VPC Access Connector

This page shows how to write Terraform for Serverless VPC Access Connector and write them securely.

google_vpc_access_connector (Terraform)

The Connector in Serverless VPC Access can be configured in Terraform with the resource name google_vpc_access_connector. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

vpc-connector.tf#L13
resource "google_vpc_access_connector" "svl-vpc-con-10-100-1-32" {
  project        = var.project_id
  name           = "svl-vpc-con-10-100-1-32"
  ip_cidr_range  = "10.100.1.32/28"
  network        = var.vpc_name
  region         = var.primary_region
main.tf#L1
resource "google_vpc_access_connector" "connector" {
  name          = var.name
  ip_cidr_range = var.ip_cidr
  network       = var.network
}
network.tf#L20
resource "google_vpc_access_connector" "cloud_run" {
  name          = "cloud-run-vpc-connector"
  ip_cidr_range = "10.8.0.0/28"
  network       = google_compute_network.private_network.name
memorystore.tf#L35
resource "google_vpc_access_connector" "serverless-connector" {
  name           = "redis-serverless-vpc"
  ip_cidr_range  = "10.8.0.0/28"
  region         = var.region
  network        = google_compute_network.redis-network.name
  min_throughput = 200

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The range of internal addresses that follows RFC 4632 notation. Example: '10.132.0.0/28'.

Maximum throughput of the connector in Mbps, must be greater than 'min_throughput'. Default is 1000.

Minimum throughput of the connector in Mbps. Default and min is 200.

The name of the resource (Max 25 characters).

Name of the VPC network. Required if 'ip_cidr_range' is set.

Region where the VPC Access connector resides. If it is not provided, the provider region is used.

The fully qualified name of this VPC connector

  • state optional computed - string

State of the VPC access connector.

Explanation in Terraform Registry

Serverless VPC Access connector resource. To get more information about Connector, see:

Frequently asked questions

What is Google Serverless VPC Access Connector?

Google Serverless VPC Access Connector is a resource for Serverless VPC Access of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Serverless VPC Access Connector?

For Terraform, the skymars-cloud/terraform-gcp, c2pig/virtual-waiting-room and randrusiak/daftacademy-gcp-terraform source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.