Subnet class

Subnet in a private cloud. A Private Cloud contains two types of subnets: management subnets (such as vMotion) that are read-only,and userDefined, which can also be updated. This resource should be used to read and update userDefined subnets. To read management subnets, please utilize the subnet data source.

To get more information about Subnet, see:

Example Usage

Vmware Engine Subnet User Defined

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const subnet_nw = new gcp.vmwareengine.Network("subnet-nw", {
    name: "pc-nw",
    location: "global",
    type: "STANDARD",
    description: "PC network description.",
});
const subnet_pc = new gcp.vmwareengine.PrivateCloud("subnet-pc", {
    location: "us-west1-a",
    name: "sample-pc",
    description: "Sample test PC.",
    networkConfig: {
        managementCidr: "192.168.50.0/24",
        vmwareEngineNetwork: subnet_nw.id,
    },
    managementCluster: {
        clusterId: "sample-mgmt-cluster",
        nodeTypeConfigs: [{
            nodeTypeId: "standard-72",
            nodeCount: 3,
        }],
    },
});
const vmw_engine_subnet = new gcp.vmwareengine.Subnet("vmw-engine-subnet", {
    name: "service-1",
    parent: subnet_pc.id,
    ipCidrRange: "192.168.100.0/26",
});
import pulumi
import pulumi_gcp as gcp

subnet_nw = gcp.vmwareengine.Network("subnet-nw",
    name="pc-nw",
    location="global",
    type="STANDARD",
    description="PC network description.")
subnet_pc = gcp.vmwareengine.PrivateCloud("subnet-pc",
    location="us-west1-a",
    name="sample-pc",
    description="Sample test PC.",
    network_config={
        "management_cidr": "192.168.50.0/24",
        "vmware_engine_network": subnet_nw.id,
    },
    management_cluster={
        "cluster_id": "sample-mgmt-cluster",
        "node_type_configs": [{
            "node_type_id": "standard-72",
            "node_count": 3,
        }],
    })
vmw_engine_subnet = gcp.vmwareengine.Subnet("vmw-engine-subnet",
    name="service-1",
    parent=subnet_pc.id,
    ip_cidr_range="192.168.100.0/26")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var subnet_nw = new Gcp.VMwareEngine.Network("subnet-nw", new()
    {
        Name = "pc-nw",
        Location = "global",
        Type = "STANDARD",
        Description = "PC network description.",
    });

    var subnet_pc = new Gcp.VMwareEngine.PrivateCloud("subnet-pc", new()
    {
        Location = "us-west1-a",
        Name = "sample-pc",
        Description = "Sample test PC.",
        NetworkConfig = new Gcp.VMwareEngine.Inputs.PrivateCloudNetworkConfigArgs
        {
            ManagementCidr = "192.168.50.0/24",
            VmwareEngineNetwork = subnet_nw.Id,
        },
        ManagementCluster = new Gcp.VMwareEngine.Inputs.PrivateCloudManagementClusterArgs
        {
            ClusterId = "sample-mgmt-cluster",
            NodeTypeConfigs = new[]
            {
                new Gcp.VMwareEngine.Inputs.PrivateCloudManagementClusterNodeTypeConfigArgs
                {
                    NodeTypeId = "standard-72",
                    NodeCount = 3,
                },
            },
        },
    });

    var vmw_engine_subnet = new Gcp.VMwareEngine.Subnet("vmw-engine-subnet", new()
    {
        Name = "service-1",
        Parent = subnet_pc.Id,
        IpCidrRange = "192.168.100.0/26",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/vmwareengine"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		subnet_nw, err := vmwareengine.NewNetwork(ctx, "subnet-nw", &vmwareengine.NetworkArgs{
			Name:        pulumi.String("pc-nw"),
			Location:    pulumi.String("global"),
			Type:        pulumi.String("STANDARD"),
			Description: pulumi.String("PC network description."),
		})
		if err != nil {
			return err
		}
		subnet_pc, err := vmwareengine.NewPrivateCloud(ctx, "subnet-pc", &vmwareengine.PrivateCloudArgs{
			Location:    pulumi.String("us-west1-a"),
			Name:        pulumi.String("sample-pc"),
			Description: pulumi.String("Sample test PC."),
			NetworkConfig: &vmwareengine.PrivateCloudNetworkConfigArgs{
				ManagementCidr:      pulumi.String("192.168.50.0/24"),
				VmwareEngineNetwork: subnet_nw.ID().ToIDOutput().ToStringOutput(),
			},
			ManagementCluster: &vmwareengine.PrivateCloudManagementClusterArgs{
				ClusterId: pulumi.String("sample-mgmt-cluster"),
				NodeTypeConfigs: vmwareengine.PrivateCloudManagementClusterNodeTypeConfigArray{
					&vmwareengine.PrivateCloudManagementClusterNodeTypeConfigArgs{
						NodeTypeId: pulumi.String("standard-72"),
						NodeCount:  pulumi.Int(3),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = vmwareengine.NewSubnet(ctx, "vmw-engine-subnet", &vmwareengine.SubnetArgs{
			Name:        pulumi.String("service-1"),
			Parent:      subnet_pc.ID().ToIDOutput().ToStringOutput(),
			IpCidrRange: pulumi.String("192.168.100.0/26"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_vmwareengine_network" "subnet-nw" {
  name        = "pc-nw"
  location    = "global"
  type        = "STANDARD"
  description = "PC network description."
}
resource "gcp_vmwareengine_privatecloud" "subnet-pc" {
  location    = "us-west1-a"
  name        = "sample-pc"
  description = "Sample test PC."
  network_config = {
    management_cidr       = "192.168.50.0/24"
    vmware_engine_network = gcp_vmwareengine_network.subnet-nw.id
  }
  management_cluster = {
    cluster_id = "sample-mgmt-cluster"
    node_type_configs = [{
      "nodeTypeId" = "standard-72"
      "nodeCount"  = 3
    }]
  }
}
resource "gcp_vmwareengine_subnet" "vmw-engine-subnet" {
  name          = "service-1"
  parent        = gcp_vmwareengine_privatecloud.subnet-pc.id
  ip_cidr_range = "192.168.100.0/26"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.vmwareengine.Network;
import com.pulumi.gcp.vmwareengine.NetworkArgs;
import com.pulumi.gcp.vmwareengine.PrivateCloud;
import com.pulumi.gcp.vmwareengine.PrivateCloudArgs;
import com.pulumi.gcp.vmwareengine.inputs.PrivateCloudNetworkConfigArgs;
import com.pulumi.gcp.vmwareengine.inputs.PrivateCloudManagementClusterArgs;
import com.pulumi.gcp.vmwareengine.inputs.PrivateCloudManagementClusterNodeTypeConfigArgs;
import com.pulumi.gcp.vmwareengine.Subnet;
import com.pulumi.gcp.vmwareengine.SubnetArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var subnet_nw = new Network("subnet-nw", NetworkArgs.builder()
            .name("pc-nw")
            .location("global")
            .type("STANDARD")
            .description("PC network description.")
            .build());

        var subnet_pc = new PrivateCloud("subnet-pc", PrivateCloudArgs.builder()
            .location("us-west1-a")
            .name("sample-pc")
            .description("Sample test PC.")
            .networkConfig(PrivateCloudNetworkConfigArgs.builder()
                .managementCidr("192.168.50.0/24")
                .vmwareEngineNetwork(subnet_nw.id())
                .build())
            .managementCluster(PrivateCloudManagementClusterArgs.builder()
                .clusterId("sample-mgmt-cluster")
                .nodeTypeConfigs(PrivateCloudManagementClusterNodeTypeConfigArgs.builder()
                    .nodeTypeId("standard-72")
                    .nodeCount(3)
                    .build())
                .build())
            .build());

        var vmw_engine_subnet = new Subnet("vmw-engine-subnet", SubnetArgs.builder()
            .name("service-1")
            .parent(subnet_pc.id())
            .ipCidrRange("192.168.100.0/26")
            .build());

    }
}
resources:
  subnet-nw:
    type: gcp:vmwareengine:Network
    properties:
      name: pc-nw
      location: global
      type: STANDARD
      description: PC network description.
  subnet-pc:
    type: gcp:vmwareengine:PrivateCloud
    properties:
      location: us-west1-a
      name: sample-pc
      description: Sample test PC.
      networkConfig:
        managementCidr: 192.168.50.0/24
        vmwareEngineNetwork: ${["subnet-nw"].id}
      managementCluster:
        clusterId: sample-mgmt-cluster
        nodeTypeConfigs:
          - nodeTypeId: standard-72
            nodeCount: 3
  vmw-engine-subnet:
    type: gcp:vmwareengine:Subnet
    properties:
      name: service-1
      parent: ${["subnet-pc"].id}
      ipCidrRange: 192.168.100.0/26

Import

Subnet can be imported using any of these accepted formats:

  • {{parent}}/subnets/{{name}}

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

$ pulumi import gcp:vmwareengine/subnet:Subnet default {{parent}}/subnets/{{name}}

Constructors

Subnet(String name, {SubnetArgs? args, CustomResourceOptions? options})
Creates a new Subnet. name The Pulumi resource name. args Arguments used to configure this Subnet. The set of arguments for Subnet. options Resource options controlling this resource's behavior.
Subnet.reference(String urn)
Creates a typed reference to an existing Subnet resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
createTime ↔ Output<String>
Creation time of this resource. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
latefinal
dhcpAddressRanges ↔ Output<List<SubnetDhcpAddressRange>>
DHCP address ranges. Structure is documented below.
latefinal
gatewayId ↔ Output<String>
The canonical identifier of the logical router that this subnet is attached to.
latefinal
gatewayIp ↔ Output<String>
The IP address of the gateway of this subnet. Must fall within the IP prefix defined above.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
ipCidrRange ↔ Output<String>
The IP address range of the subnet in CIDR format.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
The ID of the subnet. For userDefined subnets, this name should be in the format of "service-n", where n ranges from 1 to 5.
latefinal
parent ↔ Output<String>
The resource name of the private cloud to create a new subnet in. Resource names are schemeless URIs that follow the conventions in https://cloud.google.com/apis/design/resource_names. For example: projects/my-project/locations/us-west1-a/privateClouds/my-cloud
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
standardConfig ↔ Output<bool>
Whether the NSX-T configuration in the backend follows the standard configuration supported by Google Cloud. If false, the subnet cannot be modified through Google Cloud, only through NSX-T directly.
latefinal
state ↔ Output<String>
State of the subnet.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
type ↔ Output<String>
The type of the subnet.
latefinal
uid ↔ Output<String>
System-generated unique identifier for the resource.
latefinal
updateTime ↔ Output<String>
Last updated time of this resource. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
latefinal
urn ↔ Output<String>
latefinalinherited
vlanId ↔ Output<int>
VLAN ID of the VLAN on which the subnet is configured.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {SubnetState? state, CustomResourceOptions? options}) → Subnet
Gets an existing Subnet resource's state with the given name and id.