1. Packages
  2. Linode Provider
  3. API Docs
  4. VpcSubnet
Linode v4.37.0 published on Thursday, Apr 10, 2025 by Pulumi

linode.VpcSubnet

Explore with Pulumi AI

Manages a Linode VPC subnet. For more information, see the Linode APIv4 docs.

Example Usage

Create a VPC subnet:

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

const test = new linode.VpcSubnet("test", {
    vpcId: 123,
    label: "test-subnet",
    ipv4: "10.0.0.0/24",
});
Copy
import pulumi
import pulumi_linode as linode

test = linode.VpcSubnet("test",
    vpc_id=123,
    label="test-subnet",
    ipv4="10.0.0.0/24")
Copy
package main

import (
	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := linode.NewVpcSubnet(ctx, "test", &linode.VpcSubnetArgs{
			VpcId: pulumi.Int(123),
			Label: pulumi.String("test-subnet"),
			Ipv4:  pulumi.String("10.0.0.0/24"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;

return await Deployment.RunAsync(() => 
{
    var test = new Linode.VpcSubnet("test", new()
    {
        VpcId = 123,
        Label = "test-subnet",
        Ipv4 = "10.0.0.0/24",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.VpcSubnet;
import com.pulumi.linode.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 test = new VpcSubnet("test", VpcSubnetArgs.builder()
            .vpcId(123)
            .label("test-subnet")
            .ipv4("10.0.0.0/24")
            .build());

    }
}
Copy
resources:
  test:
    type: linode:VpcSubnet
    properties:
      vpcId: 123
      label: test-subnet
      ipv4: 10.0.0.0/24
Copy

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,
              ipv4: Optional[str] = None,
              label: Optional[str] = None,
              vpc_id: Optional[int] = 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: linode:VpcSubnet
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. VpcSubnetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. VpcSubnetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VpcSubnetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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 Linode.VpcSubnet("vpcSubnetResource", new()
{
    Ipv4 = "string",
    Label = "string",
    VpcId = 0,
});
Copy
example, err := linode.NewVpcSubnet(ctx, "vpcSubnetResource", &linode.VpcSubnetArgs{
	Ipv4:  pulumi.String("string"),
	Label: pulumi.String("string"),
	VpcId: pulumi.Int(0),
})
Copy
var vpcSubnetResource = new VpcSubnet("vpcSubnetResource", VpcSubnetArgs.builder()
    .ipv4("string")
    .label("string")
    .vpcId(0)
    .build());
Copy
vpc_subnet_resource = linode.VpcSubnet("vpcSubnetResource",
    ipv4="string",
    label="string",
    vpc_id=0)
Copy
const vpcSubnetResource = new linode.VpcSubnet("vpcSubnetResource", {
    ipv4: "string",
    label: "string",
    vpcId: 0,
});
Copy
type: linode:VpcSubnet
properties:
    ipv4: string
    label: string
    vpcId: 0
Copy

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:

Ipv4 This property is required. string
The IPv4 range of this subnet in CIDR format.
Label This property is required. string
The label of the VPC. Only contains ASCII letters, digits and dashes.
VpcId This property is required. int
The id of the parent VPC for this VPC Subnet.
Ipv4 This property is required. string
The IPv4 range of this subnet in CIDR format.
Label This property is required. string
The label of the VPC. Only contains ASCII letters, digits and dashes.
VpcId This property is required. int
The id of the parent VPC for this VPC Subnet.
ipv4 This property is required. String
The IPv4 range of this subnet in CIDR format.
label This property is required. String
The label of the VPC. Only contains ASCII letters, digits and dashes.
vpcId This property is required. Integer
The id of the parent VPC for this VPC Subnet.
ipv4 This property is required. string
The IPv4 range of this subnet in CIDR format.
label This property is required. string
The label of the VPC. Only contains ASCII letters, digits and dashes.
vpcId This property is required. number
The id of the parent VPC for this VPC Subnet.
ipv4 This property is required. str
The IPv4 range of this subnet in CIDR format.
label This property is required. str
The label of the VPC. Only contains ASCII letters, digits and dashes.
vpc_id This property is required. int
The id of the parent VPC for this VPC Subnet.
ipv4 This property is required. String
The IPv4 range of this subnet in CIDR format.
label This property is required. String
The label of the VPC. Only contains ASCII letters, digits and dashes.
vpcId This property is required. Number
The id of the parent VPC for this VPC Subnet.

Outputs

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

Created string
The date and time when the VPC was created.
Id string
The provider-assigned unique ID for this managed resource.
Linodes List<VpcSubnetLinode>
A list of Linode IDs that added to this subnet.
Updated string
The date and time when the VPC was last updated.
Created string
The date and time when the VPC was created.
Id string
The provider-assigned unique ID for this managed resource.
Linodes []VpcSubnetLinode
A list of Linode IDs that added to this subnet.
Updated string
The date and time when the VPC was last updated.
created String
The date and time when the VPC was created.
id String
The provider-assigned unique ID for this managed resource.
linodes List<VpcSubnetLinode>
A list of Linode IDs that added to this subnet.
updated String
The date and time when the VPC was last updated.
created string
The date and time when the VPC was created.
id string
The provider-assigned unique ID for this managed resource.
linodes VpcSubnetLinode[]
A list of Linode IDs that added to this subnet.
updated string
The date and time when the VPC was last updated.
created str
The date and time when the VPC was created.
id str
The provider-assigned unique ID for this managed resource.
linodes Sequence[VpcSubnetLinode]
A list of Linode IDs that added to this subnet.
updated str
The date and time when the VPC was last updated.
created String
The date and time when the VPC was created.
id String
The provider-assigned unique ID for this managed resource.
linodes List<Property Map>
A list of Linode IDs that added to this subnet.
updated String
The date and time when the VPC was last updated.

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,
        created: Optional[str] = None,
        ipv4: Optional[str] = None,
        label: Optional[str] = None,
        linodes: Optional[Sequence[VpcSubnetLinodeArgs]] = None,
        updated: Optional[str] = None,
        vpc_id: Optional[int] = 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: linode:VpcSubnet    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Created string
The date and time when the VPC was created.
Ipv4 string
The IPv4 range of this subnet in CIDR format.
Label string
The label of the VPC. Only contains ASCII letters, digits and dashes.
Linodes List<VpcSubnetLinode>
A list of Linode IDs that added to this subnet.
Updated string
The date and time when the VPC was last updated.
VpcId int
The id of the parent VPC for this VPC Subnet.
Created string
The date and time when the VPC was created.
Ipv4 string
The IPv4 range of this subnet in CIDR format.
Label string
The label of the VPC. Only contains ASCII letters, digits and dashes.
Linodes []VpcSubnetLinodeArgs
A list of Linode IDs that added to this subnet.
Updated string
The date and time when the VPC was last updated.
VpcId int
The id of the parent VPC for this VPC Subnet.
created String
The date and time when the VPC was created.
ipv4 String
The IPv4 range of this subnet in CIDR format.
label String
The label of the VPC. Only contains ASCII letters, digits and dashes.
linodes List<VpcSubnetLinode>
A list of Linode IDs that added to this subnet.
updated String
The date and time when the VPC was last updated.
vpcId Integer
The id of the parent VPC for this VPC Subnet.
created string
The date and time when the VPC was created.
ipv4 string
The IPv4 range of this subnet in CIDR format.
label string
The label of the VPC. Only contains ASCII letters, digits and dashes.
linodes VpcSubnetLinode[]
A list of Linode IDs that added to this subnet.
updated string
The date and time when the VPC was last updated.
vpcId number
The id of the parent VPC for this VPC Subnet.
created str
The date and time when the VPC was created.
ipv4 str
The IPv4 range of this subnet in CIDR format.
label str
The label of the VPC. Only contains ASCII letters, digits and dashes.
linodes Sequence[VpcSubnetLinodeArgs]
A list of Linode IDs that added to this subnet.
updated str
The date and time when the VPC was last updated.
vpc_id int
The id of the parent VPC for this VPC Subnet.
created String
The date and time when the VPC was created.
ipv4 String
The IPv4 range of this subnet in CIDR format.
label String
The label of the VPC. Only contains ASCII letters, digits and dashes.
linodes List<Property Map>
A list of Linode IDs that added to this subnet.
updated String
The date and time when the VPC was last updated.
vpcId Number
The id of the parent VPC for this VPC Subnet.

Supporting Types

VpcSubnetLinode
, VpcSubnetLinodeArgs

Id This property is required. int
The ID of the VPC Subnet.
Interfaces This property is required. List<VpcSubnetLinodeInterface>
Id This property is required. int
The ID of the VPC Subnet.
Interfaces This property is required. []VpcSubnetLinodeInterface
id This property is required. Integer
The ID of the VPC Subnet.
interfaces This property is required. List<VpcSubnetLinodeInterface>
id This property is required. number
The ID of the VPC Subnet.
interfaces This property is required. VpcSubnetLinodeInterface[]
id This property is required. int
The ID of the VPC Subnet.
interfaces This property is required. Sequence[VpcSubnetLinodeInterface]
id This property is required. Number
The ID of the VPC Subnet.
interfaces This property is required. List<Property Map>

VpcSubnetLinodeInterface
, VpcSubnetLinodeInterfaceArgs

Active This property is required. bool
Id This property is required. int
The ID of the VPC Subnet.
Active This property is required. bool
Id This property is required. int
The ID of the VPC Subnet.
active This property is required. Boolean
id This property is required. Integer
The ID of the VPC Subnet.
active This property is required. boolean
id This property is required. number
The ID of the VPC Subnet.
active This property is required. bool
id This property is required. int
The ID of the VPC Subnet.
active This property is required. Boolean
id This property is required. Number
The ID of the VPC Subnet.

Import

Linode Virtual Private Cloud (VPC) Subnet can be imported using the vpc_id followed by the subnet id separated by a comma, e.g.

$ pulumi import linode:index/vpcSubnet:VpcSubnet my_subnet_duplicated 1234567,7654321
Copy

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

Package Details

Repository
Linode pulumi/pulumi-linode
License
Apache-2.0
Notes
This Pulumi package is based on the linode Terraform Provider.