volcengine.vpc.Subnet
Explore with Pulumi AI
Provides a resource to manage subnet
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@volcengine/pulumi";
const foo = new volcengine.vpc.Subnet("foo", {
    cidrBlock: "192.168.1.0/24",
    subnetName: "subnet-test-2",
    vpcId: "vpc-2749wnlhro3y87fap8u5ztvt5",
    zoneId: "cn-beijing",
});
import pulumi
import pulumi_volcengine as volcengine
foo = volcengine.vpc.Subnet("foo",
    cidr_block="192.168.1.0/24",
    subnet_name="subnet-test-2",
    vpc_id="vpc-2749wnlhro3y87fap8u5ztvt5",
    zone_id="cn-beijing")
package main
import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vpc.NewSubnet(ctx, "foo", &vpc.SubnetArgs{
			CidrBlock:  pulumi.String("192.168.1.0/24"),
			SubnetName: pulumi.String("subnet-test-2"),
			VpcId:      pulumi.String("vpc-2749wnlhro3y87fap8u5ztvt5"),
			ZoneId:     pulumi.String("cn-beijing"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() => 
{
    var foo = new Volcengine.Vpc.Subnet("foo", new()
    {
        CidrBlock = "192.168.1.0/24",
        SubnetName = "subnet-test-2",
        VpcId = "vpc-2749wnlhro3y87fap8u5ztvt5",
        ZoneId = "cn-beijing",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.vpc.Subnet;
import com.pulumi.volcengine.vpc.SubnetArgs;
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 foo = new Subnet("foo", SubnetArgs.builder()        
            .cidrBlock("192.168.1.0/24")
            .subnetName("subnet-test-2")
            .vpcId("vpc-2749wnlhro3y87fap8u5ztvt5")
            .zoneId("cn-beijing")
            .build());
    }
}
resources:
  foo:
    type: volcengine:vpc:Subnet
    properties:
      cidrBlock: 192.168.1.0/24
      subnetName: subnet-test-2
      vpcId: vpc-2749wnlhro3y87fap8u5ztvt5
      zoneId: cn-beijing
Create Subnet Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Subnet(name: string, args: SubnetArgs, opts?: CustomResourceOptions);@overload
def Subnet(resource_name: str,
           args: SubnetArgs,
           opts: Optional[ResourceOptions] = None)
@overload
def Subnet(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           cidr_block: Optional[str] = None,
           vpc_id: Optional[str] = None,
           zone_id: Optional[str] = None,
           description: Optional[str] = None,
           enable_ipv6: Optional[bool] = None,
           ipv6_cidr_block: Optional[int] = None,
           subnet_name: Optional[str] = None,
           tags: Optional[Sequence[SubnetTagArgs]] = None)func NewSubnet(ctx *Context, name string, args SubnetArgs, opts ...ResourceOption) (*Subnet, error)public Subnet(string name, SubnetArgs args, CustomResourceOptions? opts = null)
public Subnet(String name, SubnetArgs args)
public Subnet(String name, SubnetArgs args, CustomResourceOptions options)
type: volcengine:vpc:Subnet
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 SubnetArgs
- 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 SubnetArgs
- 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 SubnetArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SubnetArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SubnetArgs
- 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 subnetResource = new Volcengine.Vpc.Subnet("subnetResource", new()
{
    CidrBlock = "string",
    VpcId = "string",
    ZoneId = "string",
    Description = "string",
    EnableIpv6 = false,
    Ipv6CidrBlock = 0,
    SubnetName = "string",
    Tags = new[]
    {
        new Volcengine.Vpc.Inputs.SubnetTagArgs
        {
            Key = "string",
            Value = "string",
        },
    },
});
example, err := vpc.NewSubnet(ctx, "subnetResource", &vpc.SubnetArgs{
	CidrBlock:     pulumi.String("string"),
	VpcId:         pulumi.String("string"),
	ZoneId:        pulumi.String("string"),
	Description:   pulumi.String("string"),
	EnableIpv6:    pulumi.Bool(false),
	Ipv6CidrBlock: pulumi.Int(0),
	SubnetName:    pulumi.String("string"),
	Tags: vpc.SubnetTagArray{
		&vpc.SubnetTagArgs{
			Key:   pulumi.String("string"),
			Value: pulumi.String("string"),
		},
	},
})
var subnetResource = new Subnet("subnetResource", SubnetArgs.builder()
    .cidrBlock("string")
    .vpcId("string")
    .zoneId("string")
    .description("string")
    .enableIpv6(false)
    .ipv6CidrBlock(0)
    .subnetName("string")
    .tags(SubnetTagArgs.builder()
        .key("string")
        .value("string")
        .build())
    .build());
subnet_resource = volcengine.vpc.Subnet("subnetResource",
    cidr_block="string",
    vpc_id="string",
    zone_id="string",
    description="string",
    enable_ipv6=False,
    ipv6_cidr_block=0,
    subnet_name="string",
    tags=[{
        "key": "string",
        "value": "string",
    }])
const subnetResource = new volcengine.vpc.Subnet("subnetResource", {
    cidrBlock: "string",
    vpcId: "string",
    zoneId: "string",
    description: "string",
    enableIpv6: false,
    ipv6CidrBlock: 0,
    subnetName: "string",
    tags: [{
        key: "string",
        value: "string",
    }],
});
type: volcengine:vpc:Subnet
properties:
    cidrBlock: string
    description: string
    enableIpv6: false
    ipv6CidrBlock: 0
    subnetName: string
    tags:
        - key: string
          value: string
    vpcId: string
    zoneId: string
Subnet 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 Subnet resource accepts the following input properties:
- CidrBlock string
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- VpcId string
- Id of the VPC.
- ZoneId string
- Id of the Zone.
- Description string
- The description of the Subnet.
- EnableIpv6 bool
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- Ipv6CidrBlock int
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- SubnetName string
- The name of the Subnet.
- 
List<SubnetTag> 
- Tags.
- CidrBlock string
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- VpcId string
- Id of the VPC.
- ZoneId string
- Id of the Zone.
- Description string
- The description of the Subnet.
- EnableIpv6 bool
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- Ipv6CidrBlock int
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- SubnetName string
- The name of the Subnet.
- 
[]SubnetTag Args 
- Tags.
- cidrBlock String
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- vpcId String
- Id of the VPC.
- zoneId String
- Id of the Zone.
- description String
- The description of the Subnet.
- enableIpv6 Boolean
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6CidrBlock Integer
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- subnetName String
- The name of the Subnet.
- 
List<SubnetTag> 
- Tags.
- cidrBlock string
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- vpcId string
- Id of the VPC.
- zoneId string
- Id of the Zone.
- description string
- The description of the Subnet.
- enableIpv6 boolean
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6CidrBlock number
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- subnetName string
- The name of the Subnet.
- 
SubnetTag[] 
- Tags.
- cidr_block str
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- vpc_id str
- Id of the VPC.
- zone_id str
- Id of the Zone.
- description str
- The description of the Subnet.
- enable_ipv6 bool
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6_cidr_ intblock 
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- subnet_name str
- The name of the Subnet.
- 
Sequence[SubnetTag Args] 
- Tags.
- cidrBlock String
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- vpcId String
- Id of the VPC.
- zoneId String
- Id of the Zone.
- description String
- The description of the Subnet.
- enableIpv6 Boolean
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6CidrBlock Number
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- subnetName String
- The name of the Subnet.
- List<Property Map>
- Tags.
Outputs
All input properties are implicitly available as output properties. Additionally, the Subnet resource produces the following output properties:
- CreationTime string
- Creation time of Subnet.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- Status of Subnet.
- CreationTime string
- Creation time of Subnet.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- Status of Subnet.
- creationTime String
- Creation time of Subnet.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- Status of Subnet.
- creationTime string
- Creation time of Subnet.
- id string
- The provider-assigned unique ID for this managed resource.
- status string
- Status of Subnet.
- creation_time str
- Creation time of Subnet.
- id str
- The provider-assigned unique ID for this managed resource.
- status str
- Status of Subnet.
- creationTime String
- Creation time of Subnet.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- Status of Subnet.
Look up Existing Subnet Resource
Get an existing Subnet 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?: SubnetState, opts?: CustomResourceOptions): Subnet@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cidr_block: Optional[str] = None,
        creation_time: Optional[str] = None,
        description: Optional[str] = None,
        enable_ipv6: Optional[bool] = None,
        ipv6_cidr_block: Optional[int] = None,
        status: Optional[str] = None,
        subnet_name: Optional[str] = None,
        tags: Optional[Sequence[SubnetTagArgs]] = None,
        vpc_id: Optional[str] = None,
        zone_id: Optional[str] = None) -> Subnetfunc GetSubnet(ctx *Context, name string, id IDInput, state *SubnetState, opts ...ResourceOption) (*Subnet, error)public static Subnet Get(string name, Input<string> id, SubnetState? state, CustomResourceOptions? opts = null)public static Subnet get(String name, Output<String> id, SubnetState state, CustomResourceOptions options)resources:  _:    type: volcengine:vpc:Subnet    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.
- CidrBlock string
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- CreationTime string
- Creation time of Subnet.
- Description string
- The description of the Subnet.
- EnableIpv6 bool
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- Ipv6CidrBlock int
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- Status string
- Status of Subnet.
- SubnetName string
- The name of the Subnet.
- 
List<SubnetTag> 
- Tags.
- VpcId string
- Id of the VPC.
- ZoneId string
- Id of the Zone.
- CidrBlock string
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- CreationTime string
- Creation time of Subnet.
- Description string
- The description of the Subnet.
- EnableIpv6 bool
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- Ipv6CidrBlock int
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- Status string
- Status of Subnet.
- SubnetName string
- The name of the Subnet.
- 
[]SubnetTag Args 
- Tags.
- VpcId string
- Id of the VPC.
- ZoneId string
- Id of the Zone.
- cidrBlock String
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- creationTime String
- Creation time of Subnet.
- description String
- The description of the Subnet.
- enableIpv6 Boolean
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6CidrBlock Integer
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- status String
- Status of Subnet.
- subnetName String
- The name of the Subnet.
- 
List<SubnetTag> 
- Tags.
- vpcId String
- Id of the VPC.
- zoneId String
- Id of the Zone.
- cidrBlock string
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- creationTime string
- Creation time of Subnet.
- description string
- The description of the Subnet.
- enableIpv6 boolean
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6CidrBlock number
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- status string
- Status of Subnet.
- subnetName string
- The name of the Subnet.
- 
SubnetTag[] 
- Tags.
- vpcId string
- Id of the VPC.
- zoneId string
- Id of the Zone.
- cidr_block str
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- creation_time str
- Creation time of Subnet.
- description str
- The description of the Subnet.
- enable_ipv6 bool
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6_cidr_ intblock 
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- status str
- Status of Subnet.
- subnet_name str
- The name of the Subnet.
- 
Sequence[SubnetTag Args] 
- Tags.
- vpc_id str
- Id of the VPC.
- zone_id str
- Id of the Zone.
- cidrBlock String
- A network address block which should be a subnet of the three internal network segments (10.0.0.0/16, 172.16.0.0/12 and 192.168.0.0/16).
- creationTime String
- Creation time of Subnet.
- description String
- The description of the Subnet.
- enableIpv6 Boolean
- Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6CidrBlock Number
- The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- status String
- Status of Subnet.
- subnetName String
- The name of the Subnet.
- List<Property Map>
- Tags.
- vpcId String
- Id of the VPC.
- zoneId String
- Id of the Zone.
Supporting Types
SubnetTag, SubnetTagArgs    
Import
Subnet can be imported using the id, e.g.
$ pulumi import volcengine:vpc/subnet:Subnet default subnet-274oj9a8rs9a87fap8sf9515b
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the volcengineTerraform Provider.