Skip to main content
Providers

Subnetwork

A resource of the GCP provider, version 0.2.0, in its Networking group. Import it with:

import Subnetwork from "gcp/networking"

Example

resource Subnetwork example {
    name                  = "example-value"
    network               = "example-value"
    ipCidrRange           = "example-value"
    region                = "example-value"
    privateIpGoogleAccess = false
    description           = "example-value"
}

Properties

Set by your code in the resource block. A required one must be set; any other you leave out takes the value under Default, if it has one.

NameTypeDefaultRequiredDescription
namestring—NoThe name of the subnetwork
networkstring—NoThe VPC network name or self-link this subnet belongs to
ipCidrRangestring—NoThe IPv4 CIDR range for this subnetwork (e.g., 10.0.1.0/24)
regionstring—NoThe GCP region for this subnetwork (e.g., us-central1)
privateIpGoogleAccessbooleanfalseNoWhether VMs in this subnet can access Google APIs without external IP
descriptionstring—NoAn optional description of the subnetwork

Set by GCP after the resource is created: your code can read them but not set them. An importable one identifies an existing resource.

NameTypeImportableDescription
subnetworkIdstringYesThe unique subnetwork ID assigned by GCP
selfLinkstringNoThe self-link URL of the subnetwork
gatewayAddressstringNoThe gateway address for default routing in this subnetwork

On this page