1. Packages
  2. Packages
  3. Civo Provider
  4. API Docs
  5. VpcSubnet
Viewing docs for civo 1.2.3
published on Thursday, Apr 9, 2026 by civo
civo logo
Viewing docs for civo 1.2.3
published on Thursday, Apr 9, 2026 by civo

    Provides a Civo VPC subnet resource. This can be used to create and delete subnets within a VPC network.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as civo from "@pulumi/civo";
    
    const example = new civo.VpcNetwork("example", {label: "example-network"});
    const exampleVpcSubnet = new civo.VpcSubnet("example", {
        name: "example-subnet",
        networkId: example.vpcNetworkId,
    });
    
    import pulumi
    import pulumi_civo as civo
    
    example = civo.VpcNetwork("example", label="example-network")
    example_vpc_subnet = civo.VpcSubnet("example",
        name="example-subnet",
        network_id=example.vpc_network_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/civo/civo"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := civo.NewVpcNetwork(ctx, "example", &civo.VpcNetworkArgs{
    			Label: pulumi.String("example-network"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = civo.NewVpcSubnet(ctx, "example", &civo.VpcSubnetArgs{
    			Name:      pulumi.String("example-subnet"),
    			NetworkId: example.VpcNetworkId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Civo = Pulumi.Civo;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Civo.VpcNetwork("example", new()
        {
            Label = "example-network",
        });
    
        var exampleVpcSubnet = new Civo.VpcSubnet("example", new()
        {
            Name = "example-subnet",
            NetworkId = example.VpcNetworkId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.civo.VpcNetwork;
    import com.pulumi.civo.VpcNetworkArgs;
    import com.pulumi.civo.VpcSubnet;
    import com.pulumi.civo.VpcSubnetArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 example = new VpcNetwork("example", VpcNetworkArgs.builder()
                .label("example-network")
                .build());
    
            var exampleVpcSubnet = new VpcSubnet("exampleVpcSubnet", VpcSubnetArgs.builder()
                .name("example-subnet")
                .networkId(example.vpcNetworkId())
                .build());
    
        }
    }
    
    resources:
      example:
        type: civo:VpcNetwork
        properties:
          label: example-network
      exampleVpcSubnet:
        type: civo:VpcSubnet
        name: example
        properties:
          name: example-subnet
          networkId: ${example.vpcNetworkId}
    

    Create VpcSubnet Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new VpcSubnet(name: string, args: VpcSubnetArgs, opts?: CustomResourceOptions);
    @overload
    def VpcSubnet(resource_name: str,
                  args: VpcSubnetArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def VpcSubnet(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  network_id: Optional[str] = None,
                  name: Optional[str] = None,
                  region: Optional[str] = None,
                  timeouts: Optional[VpcSubnetTimeoutsArgs] = None,
                  vpc_subnet_id: Optional[str] = None)
    func NewVpcSubnet(ctx *Context, name string, args VpcSubnetArgs, opts ...ResourceOption) (*VpcSubnet, error)
    public VpcSubnet(string name, VpcSubnetArgs args, CustomResourceOptions? opts = null)
    public VpcSubnet(String name, VpcSubnetArgs args)
    public VpcSubnet(String name, VpcSubnetArgs args, CustomResourceOptions options)
    
    type: civo:VpcSubnet
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args VpcSubnetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args VpcSubnetArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args VpcSubnetArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VpcSubnetArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VpcSubnetArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var vpcSubnetResource = new Civo.VpcSubnet("vpcSubnetResource", new()
    {
        NetworkId = "string",
        Name = "string",
        Region = "string",
        Timeouts = new Civo.Inputs.VpcSubnetTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
        },
        VpcSubnetId = "string",
    });
    
    example, err := civo.NewVpcSubnet(ctx, "vpcSubnetResource", &civo.VpcSubnetArgs{
    	NetworkId: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    	Region:    pulumi.String("string"),
    	Timeouts: &civo.VpcSubnetTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    	},
    	VpcSubnetId: pulumi.String("string"),
    })
    
    var vpcSubnetResource = new VpcSubnet("vpcSubnetResource", VpcSubnetArgs.builder()
        .networkId("string")
        .name("string")
        .region("string")
        .timeouts(VpcSubnetTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .build())
        .vpcSubnetId("string")
        .build());
    
    vpc_subnet_resource = civo.VpcSubnet("vpcSubnetResource",
        network_id="string",
        name="string",
        region="string",
        timeouts={
            "create": "string",
            "delete": "string",
        },
        vpc_subnet_id="string")
    
    const vpcSubnetResource = new civo.VpcSubnet("vpcSubnetResource", {
        networkId: "string",
        name: "string",
        region: "string",
        timeouts: {
            create: "string",
            "delete": "string",
        },
        vpcSubnetId: "string",
    });
    
    type: civo:VpcSubnet
    properties:
        name: string
        networkId: string
        region: string
        timeouts:
            create: string
            delete: string
        vpcSubnetId: string
    

    VpcSubnet Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The VpcSubnet resource accepts the following input properties:

    NetworkId string
    The ID of the VPC network this subnet belongs to
    Name string
    Name for the VPC subnet
    Region string
    The region of the subnet
    Timeouts VpcSubnetTimeouts
    VpcSubnetId string
    The ID of this resource.
    NetworkId string
    The ID of the VPC network this subnet belongs to
    Name string
    Name for the VPC subnet
    Region string
    The region of the subnet
    Timeouts VpcSubnetTimeoutsArgs
    VpcSubnetId string
    The ID of this resource.
    networkId String
    The ID of the VPC network this subnet belongs to
    name String
    Name for the VPC subnet
    region String
    The region of the subnet
    timeouts VpcSubnetTimeouts
    vpcSubnetId String
    The ID of this resource.
    networkId string
    The ID of the VPC network this subnet belongs to
    name string
    Name for the VPC subnet
    region string
    The region of the subnet
    timeouts VpcSubnetTimeouts
    vpcSubnetId string
    The ID of this resource.
    network_id str
    The ID of the VPC network this subnet belongs to
    name str
    Name for the VPC subnet
    region str
    The region of the subnet
    timeouts VpcSubnetTimeoutsArgs
    vpc_subnet_id str
    The ID of this resource.
    networkId String
    The ID of the VPC network this subnet belongs to
    name String
    Name for the VPC subnet
    region String
    The region of the subnet
    timeouts Property Map
    vpcSubnetId String
    The ID of this resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VpcSubnet resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the subnet
    SubnetSize string
    The size of the subnet
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the subnet
    SubnetSize string
    The size of the subnet
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the subnet
    subnetSize String
    The size of the subnet
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the subnet
    subnetSize string
    The size of the subnet
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the subnet
    subnet_size str
    The size of the subnet
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the subnet
    subnetSize String
    The size of the subnet

    Look up Existing VpcSubnet Resource

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

    public static get(name: string, id: Input<ID>, state?: VpcSubnetState, opts?: CustomResourceOptions): VpcSubnet
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            network_id: Optional[str] = None,
            region: Optional[str] = None,
            status: Optional[str] = None,
            subnet_size: Optional[str] = None,
            timeouts: Optional[VpcSubnetTimeoutsArgs] = None,
            vpc_subnet_id: Optional[str] = None) -> VpcSubnet
    func GetVpcSubnet(ctx *Context, name string, id IDInput, state *VpcSubnetState, opts ...ResourceOption) (*VpcSubnet, error)
    public static VpcSubnet Get(string name, Input<string> id, VpcSubnetState? state, CustomResourceOptions? opts = null)
    public static VpcSubnet get(String name, Output<String> id, VpcSubnetState state, CustomResourceOptions options)
    resources:  _:    type: civo:VpcSubnet    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Name string
    Name for the VPC subnet
    NetworkId string
    The ID of the VPC network this subnet belongs to
    Region string
    The region of the subnet
    Status string
    The status of the subnet
    SubnetSize string
    The size of the subnet
    Timeouts VpcSubnetTimeouts
    VpcSubnetId string
    The ID of this resource.
    Name string
    Name for the VPC subnet
    NetworkId string
    The ID of the VPC network this subnet belongs to
    Region string
    The region of the subnet
    Status string
    The status of the subnet
    SubnetSize string
    The size of the subnet
    Timeouts VpcSubnetTimeoutsArgs
    VpcSubnetId string
    The ID of this resource.
    name String
    Name for the VPC subnet
    networkId String
    The ID of the VPC network this subnet belongs to
    region String
    The region of the subnet
    status String
    The status of the subnet
    subnetSize String
    The size of the subnet
    timeouts VpcSubnetTimeouts
    vpcSubnetId String
    The ID of this resource.
    name string
    Name for the VPC subnet
    networkId string
    The ID of the VPC network this subnet belongs to
    region string
    The region of the subnet
    status string
    The status of the subnet
    subnetSize string
    The size of the subnet
    timeouts VpcSubnetTimeouts
    vpcSubnetId string
    The ID of this resource.
    name str
    Name for the VPC subnet
    network_id str
    The ID of the VPC network this subnet belongs to
    region str
    The region of the subnet
    status str
    The status of the subnet
    subnet_size str
    The size of the subnet
    timeouts VpcSubnetTimeoutsArgs
    vpc_subnet_id str
    The ID of this resource.
    name String
    Name for the VPC subnet
    networkId String
    The ID of the VPC network this subnet belongs to
    region String
    The region of the subnet
    status String
    The status of the subnet
    subnetSize String
    The size of the subnet
    timeouts Property Map
    vpcSubnetId String
    The ID of this resource.

    Supporting Types

    VpcSubnetTimeouts, VpcSubnetTimeoutsArgs

    Create string
    Delete string
    Create string
    Delete string
    create String
    delete String
    create string
    delete string
    create str
    delete str
    create String
    delete String

    Import

    $ pulumi import civo:index/vpcSubnet:VpcSubnet example NETWORK_ID:SUBNET_ID
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Civo civo/terraform-provider-civo
    License
    Notes
    This Pulumi package is based on the civo Terraform Provider.
    civo logo
    Viewing docs for civo 1.2.3
    published on Thursday, Apr 9, 2026 by civo
      Try Pulumi Cloud free. Your team will thank you.