Google Compute Engine Region Network Endpoint Group

This page shows how to write Terraform for Compute Engine Region Network Endpoint Group and write them securely.

google_compute_region_network_endpoint_group (Terraform)

The Region Network Endpoint Group in Compute Engine can be configured in Terraform with the resource name google_compute_region_network_endpoint_group. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

resource "google_compute_region_network_endpoint_group" "serverless_neg_tw" {
  provider              = google-beta
  name                  = "serverless-neg-tw-20210928-001"
  network_endpoint_type = "SERVERLESS"
  region                = "asia-east1"
  cloud_run {
resource "google_compute_region_network_endpoint_group" "frontend" {
  depends_on = [
  project = var.project
  region  = var.region
resource "google_compute_region_network_endpoint_group" "news_api_us" {
  provider = google-beta

  project               = var.project
  name                  = "news-api-us"
  network_endpoint_type = "SERVERLESS"
resource "google_compute_region_network_endpoint_group" "templatee_neg_fe" {
  provider              = google-beta
  name                  = "templatee-neg-frontend"
  network_endpoint_type = "SERVERLESS"
  region                = var.region
  cloud_run {
resource "google_compute_region_network_endpoint_group" "prd" {
  name                  = local.NEG_NAME
  network_endpoint_type = "SERVERLESS"
  region                = var.GCP_DEPLOYMENT_REGION
  project               = data.google_project.primary.number
  cloud_run {


  • description optional - string
    • An optional description of this resource. Provide this property when you create the resource.

  • id optionalcomputed - string
  • name required - string
    • Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression 'a-z?' which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

  • network_endpoint_type optional - string
    • Type of network endpoints in this network endpoint group. Defaults to SERVERLESS Default value: "SERVERLESS" Possible values: ["SERVERLESS"]

  • project optionalcomputed - string
  • region required - string
    • A reference to the region where the Serverless NEGs Reside.

  • self_link requiredcomputed - string

Explanation in Terraform Registry

A regional NEG that can support Serverless Products. Recreating a region network endpoint group that's in use by another resource will give a resourceInUseByAnotherResource error. Use lifecycle.create_before_destroy to avoid this type of error. To get more information about RegionNetworkEndpointGroup, see:

Frequently asked questions

What is Google Compute Engine Region Network Endpoint Group?

Google Compute Engine Region Network Endpoint Group is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine Region Network Endpoint Group?

For Terraform, the michael-chi/terraform-gcp, grpcoin/grpcoin and mwarzynski/uw_irio source code examples are useful. See the Terraform Example section for further details.


Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.