google_network_connectivity_internal_range

The internal range resource for IPAM operations within a VPC network. Used to represent a private address range along with behavioral characterstics of that range (its usage and peering behavior). Networking resources can link to this range if they are created as belonging to it.

To get more information about InternalRange, see:

Open in Cloud Shell

Example Usage - Network Connectivity Internal Ranges Basic

resource "google_network_connectivity_internal_range" "default" {
  name    = "basic"
  description = "Test internal range"
  network = google_compute_network.default.self_link
  usage   = "FOR_VPC"
  peering = "FOR_SELF"
  ip_cidr_range = "10.0.0.0/24"

  labels  = {
    label-a: "b"
  }
}

resource "google_compute_network" "default" {
  name                    = "internal-ranges"
  auto_create_subnetworks = false
}
Open in Cloud Shell

Example Usage - Network Connectivity Internal Ranges Automatic Reservation

resource "google_network_connectivity_internal_range" "default" {
  name    = "automatic-reservation"
  network = google_compute_network.default.id
  usage   = "FOR_VPC"
  peering = "FOR_SELF"
  prefix_length = 24
  target_cidr_range = [
    "192.16.0.0/16"
  ]
}

resource "google_compute_network" "default" {
  name                    = "internal-ranges"
  auto_create_subnetworks = false
}
Open in Cloud Shell

Example Usage - Network Connectivity Internal Ranges External Ranges

resource "google_network_connectivity_internal_range" "default" {
  name    = "external-ranges"
  network = google_compute_network.default.id
  usage   = "EXTERNAL_TO_VPC"
  peering = "FOR_SELF"
  ip_cidr_range = "172.16.0.0/24"

  labels  = {
    external-reserved-range: "on-premises"
  }
}

resource "google_compute_network" "default" {
  name                    = "internal-ranges"
  auto_create_subnetworks = false
}
Open in Cloud Shell

Example Usage - Network Connectivity Internal Ranges Reserve With Overlap

resource "google_network_connectivity_internal_range" "default" {
  name    = "overlap-range"
  description = "Test internal range"
  network = google_compute_network.default.id
  usage   = "FOR_VPC"
  peering = "FOR_SELF"
  ip_cidr_range = "10.0.0.0/30"

  overlaps = [
    "OVERLAP_EXISTING_SUBNET_RANGE"
  ]

  depends_on = [
    google_compute_subnetwork.default
  ]
}

resource "google_compute_network" "default" {
  name                    = "internal-ranges"
  auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
  name          = "overlapping-subnet"
  ip_cidr_range = "10.0.0.0/24"
  region        = "us-central1"
  network       = google_compute_network.default.id
}

Argument Reference

The following arguments are supported:


Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

InternalRange can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import InternalRange using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/global/internalRanges/{{name}}"
  to = google_network_connectivity_internal_range.default
}

When using the terraform import command, InternalRange can be imported using one of the formats above. For example:

$ terraform import google_network_connectivity_internal_range.default projects/{{project}}/locations/global/internalRanges/{{name}}
$ terraform import google_network_connectivity_internal_range.default {{project}}/{{name}}
$ terraform import google_network_connectivity_internal_range.default {{name}}

User Project Overrides

This resource supports User Project Overrides.