volcengine.vpc.Subnet
Explore with Pulumi AI
Provides a resource to manage subnet
Example Usage
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 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
})
}
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());
}
}
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")
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",
});
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:
- Cidr
Block 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).
- Vpc
Id string - Id of the VPC.
- Zone
Id string - Id of the Zone.
- Description string
- 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.
- Ipv6Cidr
Block int - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- Subnet
Name string - The name of the Subnet.
- List<Subnet
Tag> - Tags.
- Cidr
Block 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).
- Vpc
Id string - Id of the VPC.
- Zone
Id string - Id of the Zone.
- Description string
- 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.
- Ipv6Cidr
Block int - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- Subnet
Name string - The name of the Subnet.
- []Subnet
Tag Args - Tags.
- cidr
Block 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).
- vpc
Id String - Id of the VPC.
- zone
Id String - Id of the Zone.
- description String
- The description of the Subnet.
- enable
Ipv6 Boolean - Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6Cidr
Block Integer - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- subnet
Name String - The name of the Subnet.
- List<Subnet
Tag> - Tags.
- cidr
Block 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).
- vpc
Id string - Id of the VPC.
- zone
Id string - Id of the Zone.
- description string
- The description of the Subnet.
- enable
Ipv6 boolean - Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6Cidr
Block number - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- subnet
Name string - The name of the Subnet.
- Subnet
Tag[] - 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[Subnet
Tag Args] - Tags.
- cidr
Block 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).
- vpc
Id String - Id of the VPC.
- zone
Id String - Id of the Zone.
- description String
- The description of the Subnet.
- enable
Ipv6 Boolean - Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6Cidr
Block Number - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- subnet
Name 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:
- Creation
Time string - Creation time of Subnet.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- Status of Subnet.
- Creation
Time string - Creation time of Subnet.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- Status of Subnet.
- creation
Time String - Creation time of Subnet.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- Status of Subnet.
- creation
Time 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.
- creation
Time 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) -> Subnet
func 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)
Resource lookup is not supported in YAML
- 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.
- Cidr
Block 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).
- Creation
Time string - Creation time of Subnet.
- Description string
- 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.
- Ipv6Cidr
Block int - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- Status string
- Status of Subnet.
- Subnet
Name string - The name of the Subnet.
- List<Subnet
Tag> - Tags.
- Vpc
Id string - Id of the VPC.
- Zone
Id string - Id of the Zone.
- Cidr
Block 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).
- Creation
Time string - Creation time of Subnet.
- Description string
- 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.
- Ipv6Cidr
Block int - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- Status string
- Status of Subnet.
- Subnet
Name string - The name of the Subnet.
- []Subnet
Tag Args - Tags.
- Vpc
Id string - Id of the VPC.
- Zone
Id string - Id of the Zone.
- cidr
Block 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).
- creation
Time String - Creation time of Subnet.
- description String
- The description of the Subnet.
- enable
Ipv6 Boolean - Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6Cidr
Block Integer - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- status String
- Status of Subnet.
- subnet
Name String - The name of the Subnet.
- List<Subnet
Tag> - Tags.
- vpc
Id String - Id of the VPC.
- zone
Id String - Id of the Zone.
- cidr
Block 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).
- creation
Time string - Creation time of Subnet.
- description string
- The description of the Subnet.
- enable
Ipv6 boolean - Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6Cidr
Block number - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- status string
- Status of Subnet.
- subnet
Name string - The name of the Subnet.
- Subnet
Tag[] - Tags.
- vpc
Id string - Id of the VPC.
- zone
Id 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[Subnet
Tag Args] - Tags.
- vpc_
id str - Id of the VPC.
- zone_
id str - Id of the Zone.
- cidr
Block 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).
- creation
Time String - Creation time of Subnet.
- description String
- The description of the Subnet.
- enable
Ipv6 Boolean - Specifies whether to enable the IPv6 CIDR block of the Subnet. This field is only valid when modifying the Subnet.
- ipv6Cidr
Block Number - The last eight bits of the IPv6 CIDR block of the Subnet. Valid values: 0 - 255.
- status String
- Status of Subnet.
- subnet
Name String - The name of the Subnet.
- List<Property Map>
- Tags.
- vpc
Id String - Id of the VPC.
- zone
Id 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
volcengine
Terraform Provider.