Show / Hide Table of Contents

Class Subnetwork

A VPC network is a virtual version of the traditional physical networks that exist within and between physical data centers. A VPC network provides connectivity for your Compute Engine virtual machine (VM) instances, Container Engine containers, App Engine Flex services, and other network-related resources.

Each GCP project contains one or more VPC networks. Each VPC network is a global entity spanning all GCP regions. This global VPC network allows VM instances and other resources to communicate with each other via internal, private IP addresses.

Each VPC network is subdivided into subnets, and each subnet is contained within a single region. You can have more than one subnet in a region for a given VPC network. Each subnet has a contiguous private RFC1918 IP space. You create instances, containers, and the like in these subnets. When you create an instance, you must create it in a subnet, and the instance draws its internal IP address from that subnet.

Virtual machine (VM) instances in a VPC network can communicate with instances in all other subnets of the same VPC network, regardless of region, using their RFC1918 private IP addresses. You can isolate portions of the network, even entire subnets, using firewall rules.

To get more information about Subnetwork, see:

  • API documentation
  • How-to Guides
  • Private Google Access
  • Cloud Networking

Example Usage - Subnetwork Internal L7lb

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var custom_test = new Gcp.Compute.Network("custom-test", new Gcp.Compute.NetworkArgs
    {
        AutoCreateSubnetworks = false,
    });
    var network_for_l7lb = new Gcp.Compute.Subnetwork("network-for-l7lb", new Gcp.Compute.SubnetworkArgs
    {
        IpCidrRange = "10.0.0.0/22",
        Region = "us-central1",
        Purpose = "INTERNAL_HTTPS_LOAD_BALANCER",
        Role = "ACTIVE",
        Network = custom_test.Id,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Subnetwork
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.Compute
Assembly: Pulumi.Gcp.dll
Syntax
public class Subnetwork : CustomResource

Constructors

View Source

Subnetwork(String, SubnetworkArgs, CustomResourceOptions)

Create a Subnetwork resource with the given unique name, arguments, and options.

Declaration
public Subnetwork(string name, SubnetworkArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

SubnetworkArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

CreationTimestamp

Creation timestamp in RFC3339 text format.

Declaration
public Output<string> CreationTimestamp { get; }
Property Value
Type Description
Output<System.String>
View Source

Description

An optional description of this resource. Provide this property when you create the resource. This field can be set only at resource creation time.

Declaration
public Output<string> Description { get; }
Property Value
Type Description
Output<System.String>
View Source

Fingerprint

Fingerprint of this resource. This field is used internally during updates of this resource.

Declaration
public Output<string> Fingerprint { get; }
Property Value
Type Description
Output<System.String>
View Source

GatewayAddress

The gateway address for default routes to reach destination addresses outside this subnetwork.

Declaration
public Output<string> GatewayAddress { get; }
Property Value
Type Description
Output<System.String>
View Source

IpCidrRange

The range of IP addresses belonging to this subnetwork secondary range. Provide this property when you create the subnetwork. Ranges must be unique and non-overlapping with all primary and secondary IP ranges within a network. Only IPv4 is supported.

Declaration
public Output<string> IpCidrRange { get; }
Property Value
Type Description
Output<System.String>
View Source

LogConfig

Denotes the logging options for the subnetwork flow logs. If logging is enabled logs will be exported to Stackdriver. This field cannot be set if the purpose of this subnetwork is INTERNAL_HTTPS_LOAD_BALANCER Structure is documented below.

Declaration
public Output<SubnetworkLogConfig> LogConfig { get; }
Property Value
Type Description
Output<SubnetworkLogConfig>
View Source

Name

The name of the resource, provided by the client when initially creating the resource. 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.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

Network

The network this subnet belongs to. Only networks that are in the distributed mode can have subnetworks.

Declaration
public Output<string> Network { get; }
Property Value
Type Description
Output<System.String>
View Source

PrivateIpGoogleAccess

When enabled, VMs in this subnetwork without external IP addresses can access Google APIs and services by using Private Google Access.

Declaration
public Output<bool?> PrivateIpGoogleAccess { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Project

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

Purpose

The purpose of the resource. This field can be either PRIVATE or INTERNAL_HTTPS_LOAD_BALANCER. A subnetwork with purpose set to INTERNAL_HTTPS_LOAD_BALANCER is a user-created subnetwork that is reserved for Internal HTTP(S) Load Balancing. If unspecified, the purpose defaults to PRIVATE. If set to INTERNAL_HTTPS_LOAD_BALANCER you must also set the role.

Declaration
public Output<string> Purpose { get; }
Property Value
Type Description
Output<System.String>
View Source

Region

URL of the GCP region for this subnetwork.

Declaration
public Output<string> Region { get; }
Property Value
Type Description
Output<System.String>
View Source

Role

The role of subnetwork. Currently, this field is only used when purpose = INTERNAL_HTTPS_LOAD_BALANCER. The value can be set to ACTIVE or BACKUP. An ACTIVE subnetwork is one that is currently being used for Internal HTTP(S) Load Balancing. A BACKUP subnetwork is one that is ready to be promoted to ACTIVE or is currently draining.

Declaration
public Output<string> Role { get; }
Property Value
Type Description
Output<System.String>
View Source

SecondaryIpRanges

An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange of the subnetwork. The alias IPs may belong to either primary or secondary ranges. Structure is documented below.

Declaration
public Output<ImmutableArray<SubnetworkSecondaryIpRange>> SecondaryIpRanges { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<SubnetworkSecondaryIpRange>>
View Source

SelfLink

The URI of the created resource.

Declaration
public Output<string> SelfLink { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, SubnetworkState, CustomResourceOptions)

Get an existing Subnetwork resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Subnetwork Get(string name, Input<string> id, SubnetworkState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

SubnetworkState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Subnetwork
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.