| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Network Connectivity" |
| description: |- |
| The internal range resource for IPAM operations within a VPC network. |
| --- |
| |
| # 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: |
| |
| * [API documentation](https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest/v1/projects.locations.internalRanges) |
| * How-to Guides |
| * [Use internal ranges](https://cloud.google.com/vpc/docs/create-use-internal-ranges) |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=network_connectivity_internal_ranges_basic&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Network Connectivity Internal Ranges Basic |
| |
| |
| ```hcl |
| 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 |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=network_connectivity_internal_ranges_automatic_reservation&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Network Connectivity Internal Ranges Automatic Reservation |
| |
| |
| ```hcl |
| 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 |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=network_connectivity_internal_ranges_external_ranges&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Network Connectivity Internal Ranges External Ranges |
| |
| |
| ```hcl |
| 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 |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=network_connectivity_internal_ranges_reserve_with_overlap&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Network Connectivity Internal Ranges Reserve With Overlap |
| |
| |
| ```hcl |
| 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: |
| |
| |
| * `name` - |
| (Required) |
| The name of the policy based route. |
| |
| * `network` - |
| (Required) |
| Fully-qualified URL of the network that this route applies to, for example: projects/my-project/global/networks/my-network. |
| |
| * `usage` - |
| (Required) |
| The type of usage set for this InternalRange. |
| Possible values are: `FOR_VPC`, `EXTERNAL_TO_VPC`. |
| |
| * `peering` - |
| (Required) |
| The type of peering set for this internal range. |
| Possible values are: `FOR_SELF`, `FOR_PEER`, `NOT_SHARED`. |
| |
| |
| - - - |
| |
| |
| * `labels` - |
| (Optional) |
| User-defined labels. |
| |
| **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. |
| Please refer to the field `effective_labels` for all of the labels present on the resource. |
| |
| * `description` - |
| (Optional) |
| An optional description of this resource. |
| |
| * `ip_cidr_range` - |
| (Optional) |
| The IP range that this internal range defines. |
| |
| * `prefix_length` - |
| (Optional) |
| An alternate to ipCidrRange. Can be set when trying to create a reservation that automatically finds a free range of the given size. |
| If both ipCidrRange and prefixLength are set, there is an error if the range sizes do not match. Can also be used during updates to change the range size. |
| |
| * `target_cidr_range` - |
| (Optional) |
| Optional. Can be set to narrow down or pick a different address space while searching for a free range. |
| If not set, defaults to the "10.0.0.0/8" address space. This can be used to search in other rfc-1918 address spaces like "172.16.0.0/12" and "192.168.0.0/16" or non-rfc-1918 address spaces used in the VPC. |
| |
| * `overlaps` - |
| (Optional) |
| Optional. Types of resources that are allowed to overlap with the current internal range. |
| Each value may be one of: `OVERLAP_ROUTE_RANGE`, `OVERLAP_EXISTING_SUBNET_RANGE`. |
| |
| * `project` - (Optional) The ID of the project in which the resource belongs. |
| If it is not provided, the provider project is used. |
| |
| |
| ## Attributes Reference |
| |
| In addition to the arguments listed above, the following computed attributes are exported: |
| |
| * `id` - an identifier for the resource with format `projects/{{project}}/locations/global/internalRanges/{{name}}` |
| |
| * `users` - |
| Output only. The list of resources that refer to this internal range. |
| Resources that use the internal range for their range allocation are referred to as users of the range. |
| Other resources mark themselves as users while doing so by creating a reference to this internal range. Having a user, based on this reference, prevents deletion of the internal range referred to. Can be empty. |
| |
| * `terraform_labels` - |
| The combination of labels configured directly on the resource |
| and default labels configured on the provider. |
| |
| * `effective_labels` - |
| All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. |
| |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 30 minutes. |
| - `update` - Default is 30 minutes. |
| - `delete` - Default is 30 minutes. |
| |
| ## Import |
| |
| |
| InternalRange can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/locations/global/internalRanges/{{name}}` |
| * `{{project}}/{{name}}` |
| * `{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import InternalRange using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/global/internalRanges/{{name}}" |
| to = google_network_connectivity_internal_range.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |