1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. Vpc
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.Vpc

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provide a resource to create a VPC.

    Example Usage

    Create a basic VPC

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const vpc = new tencentcloud.Vpc("vpc", {
        cidrBlock: "10.0.0.0/16",
        dnsServers: [
            "119.29.29.29",
            "8.8.8.8",
        ],
        isMulticast: false,
        tags: {
            test: "test",
        },
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    vpc = tencentcloud.Vpc("vpc",
        cidr_block="10.0.0.0/16",
        dns_servers=[
            "119.29.29.29",
            "8.8.8.8",
        ],
        is_multicast=False,
        tags={
            "test": "test",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
    			CidrBlock: pulumi.String("10.0.0.0/16"),
    			DnsServers: pulumi.StringArray{
    				pulumi.String("119.29.29.29"),
    				pulumi.String("8.8.8.8"),
    			},
    			IsMulticast: pulumi.Bool(false),
    			Tags: pulumi.StringMap{
    				"test": pulumi.String("test"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var vpc = new Tencentcloud.Vpc("vpc", new()
        {
            CidrBlock = "10.0.0.0/16",
            DnsServers = new[]
            {
                "119.29.29.29",
                "8.8.8.8",
            },
            IsMulticast = false,
            Tags = 
            {
                { "test", "test" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.Vpc;
    import com.pulumi.tencentcloud.VpcArgs;
    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 vpc = new Vpc("vpc", VpcArgs.builder()
                .cidrBlock("10.0.0.0/16")
                .dnsServers(            
                    "119.29.29.29",
                    "8.8.8.8")
                .isMulticast(false)
                .tags(Map.of("test", "test"))
                .build());
    
        }
    }
    
    resources:
      vpc:
        type: tencentcloud:Vpc
        properties:
          cidrBlock: 10.0.0.0/16
          dnsServers:
            - 119.29.29.29
            - 8.8.8.8
          isMulticast: false
          tags:
            test: test
    

    Using Assistant CIDR

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const vpc = new tencentcloud.Vpc("vpc", {
        assistantCidrs: ["172.16.0.0/24"],
        cidrBlock: "10.0.0.0/16",
        isMulticast: false,
        tags: {
            test: "test",
        },
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    vpc = tencentcloud.Vpc("vpc",
        assistant_cidrs=["172.16.0.0/24"],
        cidr_block="10.0.0.0/16",
        is_multicast=False,
        tags={
            "test": "test",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
    			AssistantCidrs: pulumi.StringArray{
    				pulumi.String("172.16.0.0/24"),
    			},
    			CidrBlock:   pulumi.String("10.0.0.0/16"),
    			IsMulticast: pulumi.Bool(false),
    			Tags: pulumi.StringMap{
    				"test": pulumi.String("test"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var vpc = new Tencentcloud.Vpc("vpc", new()
        {
            AssistantCidrs = new[]
            {
                "172.16.0.0/24",
            },
            CidrBlock = "10.0.0.0/16",
            IsMulticast = false,
            Tags = 
            {
                { "test", "test" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.Vpc;
    import com.pulumi.tencentcloud.VpcArgs;
    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 vpc = new Vpc("vpc", VpcArgs.builder()
                .assistantCidrs("172.16.0.0/24")
                .cidrBlock("10.0.0.0/16")
                .isMulticast(false)
                .tags(Map.of("test", "test"))
                .build());
    
        }
    }
    
    resources:
      vpc:
        type: tencentcloud:Vpc
        properties:
          assistantCidrs:
            - 172.16.0.0/24
          cidrBlock: 10.0.0.0/16
          isMulticast: false
          tags:
            test: test
    

    Create Vpc Resource

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

    Constructor syntax

    new Vpc(name: string, args: VpcArgs, opts?: CustomResourceOptions);
    @overload
    def Vpc(resource_name: str,
            args: VpcArgs,
            opts: Optional[ResourceOptions] = None)
    
    @overload
    def Vpc(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            cidr_block: Optional[str] = None,
            assistant_cidrs: Optional[Sequence[str]] = None,
            dns_servers: Optional[Sequence[str]] = None,
            is_multicast: Optional[bool] = None,
            name: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            vpc_id: Optional[str] = None)
    func NewVpc(ctx *Context, name string, args VpcArgs, opts ...ResourceOption) (*Vpc, error)
    public Vpc(string name, VpcArgs args, CustomResourceOptions? opts = null)
    public Vpc(String name, VpcArgs args)
    public Vpc(String name, VpcArgs args, CustomResourceOptions options)
    
    type: tencentcloud:Vpc
    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 VpcArgs
    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 VpcArgs
    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 VpcArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VpcArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VpcArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Vpc 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 Vpc 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).
    AssistantCidrs List<string>
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    DnsServers List<string>
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    IsMulticast bool
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    Name string
    The name of the VPC.
    Tags Dictionary<string, string>
    Tags of the VPC.
    VpcId string
    ID of the resource.
    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).
    AssistantCidrs []string
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    DnsServers []string
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    IsMulticast bool
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    Name string
    The name of the VPC.
    Tags map[string]string
    Tags of the VPC.
    VpcId string
    ID of the resource.
    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).
    assistantCidrs List<String>
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    dnsServers List<String>
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    isMulticast Boolean
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    name String
    The name of the VPC.
    tags Map<String,String>
    Tags of the VPC.
    vpcId String
    ID of the resource.
    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).
    assistantCidrs string[]
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    dnsServers string[]
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    isMulticast boolean
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    name string
    The name of the VPC.
    tags {[key: string]: string}
    Tags of the VPC.
    vpcId string
    ID of the resource.
    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).
    assistant_cidrs Sequence[str]
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    dns_servers Sequence[str]
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    is_multicast bool
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    name str
    The name of the VPC.
    tags Mapping[str, str]
    Tags of the VPC.
    vpc_id str
    ID of the resource.
    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).
    assistantCidrs List<String>
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    dnsServers List<String>
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    isMulticast Boolean
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    name String
    The name of the VPC.
    tags Map<String>
    Tags of the VPC.
    vpcId String
    ID of the resource.

    Outputs

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

    CreateTime string
    Creation time of VPC.
    DefaultRouteTableId string
    Default route table id, which created automatically after VPC create.
    DockerAssistantCidrs List<string>
    List of Docker Assistant CIDR.
    Id string
    The provider-assigned unique ID for this managed resource.
    IsDefault bool
    Indicates whether it is the default VPC for this region.
    CreateTime string
    Creation time of VPC.
    DefaultRouteTableId string
    Default route table id, which created automatically after VPC create.
    DockerAssistantCidrs []string
    List of Docker Assistant CIDR.
    Id string
    The provider-assigned unique ID for this managed resource.
    IsDefault bool
    Indicates whether it is the default VPC for this region.
    createTime String
    Creation time of VPC.
    defaultRouteTableId String
    Default route table id, which created automatically after VPC create.
    dockerAssistantCidrs List<String>
    List of Docker Assistant CIDR.
    id String
    The provider-assigned unique ID for this managed resource.
    isDefault Boolean
    Indicates whether it is the default VPC for this region.
    createTime string
    Creation time of VPC.
    defaultRouteTableId string
    Default route table id, which created automatically after VPC create.
    dockerAssistantCidrs string[]
    List of Docker Assistant CIDR.
    id string
    The provider-assigned unique ID for this managed resource.
    isDefault boolean
    Indicates whether it is the default VPC for this region.
    create_time str
    Creation time of VPC.
    default_route_table_id str
    Default route table id, which created automatically after VPC create.
    docker_assistant_cidrs Sequence[str]
    List of Docker Assistant CIDR.
    id str
    The provider-assigned unique ID for this managed resource.
    is_default bool
    Indicates whether it is the default VPC for this region.
    createTime String
    Creation time of VPC.
    defaultRouteTableId String
    Default route table id, which created automatically after VPC create.
    dockerAssistantCidrs List<String>
    List of Docker Assistant CIDR.
    id String
    The provider-assigned unique ID for this managed resource.
    isDefault Boolean
    Indicates whether it is the default VPC for this region.

    Look up Existing Vpc Resource

    Get an existing Vpc 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?: VpcState, opts?: CustomResourceOptions): Vpc
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            assistant_cidrs: Optional[Sequence[str]] = None,
            cidr_block: Optional[str] = None,
            create_time: Optional[str] = None,
            default_route_table_id: Optional[str] = None,
            dns_servers: Optional[Sequence[str]] = None,
            docker_assistant_cidrs: Optional[Sequence[str]] = None,
            is_default: Optional[bool] = None,
            is_multicast: Optional[bool] = None,
            name: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            vpc_id: Optional[str] = None) -> Vpc
    func GetVpc(ctx *Context, name string, id IDInput, state *VpcState, opts ...ResourceOption) (*Vpc, error)
    public static Vpc Get(string name, Input<string> id, VpcState? state, CustomResourceOptions? opts = null)
    public static Vpc get(String name, Output<String> id, VpcState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:Vpc    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:
    AssistantCidrs List<string>
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    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).
    CreateTime string
    Creation time of VPC.
    DefaultRouteTableId string
    Default route table id, which created automatically after VPC create.
    DnsServers List<string>
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    DockerAssistantCidrs List<string>
    List of Docker Assistant CIDR.
    IsDefault bool
    Indicates whether it is the default VPC for this region.
    IsMulticast bool
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    Name string
    The name of the VPC.
    Tags Dictionary<string, string>
    Tags of the VPC.
    VpcId string
    ID of the resource.
    AssistantCidrs []string
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    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).
    CreateTime string
    Creation time of VPC.
    DefaultRouteTableId string
    Default route table id, which created automatically after VPC create.
    DnsServers []string
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    DockerAssistantCidrs []string
    List of Docker Assistant CIDR.
    IsDefault bool
    Indicates whether it is the default VPC for this region.
    IsMulticast bool
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    Name string
    The name of the VPC.
    Tags map[string]string
    Tags of the VPC.
    VpcId string
    ID of the resource.
    assistantCidrs List<String>
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    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).
    createTime String
    Creation time of VPC.
    defaultRouteTableId String
    Default route table id, which created automatically after VPC create.
    dnsServers List<String>
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    dockerAssistantCidrs List<String>
    List of Docker Assistant CIDR.
    isDefault Boolean
    Indicates whether it is the default VPC for this region.
    isMulticast Boolean
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    name String
    The name of the VPC.
    tags Map<String,String>
    Tags of the VPC.
    vpcId String
    ID of the resource.
    assistantCidrs string[]
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    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).
    createTime string
    Creation time of VPC.
    defaultRouteTableId string
    Default route table id, which created automatically after VPC create.
    dnsServers string[]
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    dockerAssistantCidrs string[]
    List of Docker Assistant CIDR.
    isDefault boolean
    Indicates whether it is the default VPC for this region.
    isMulticast boolean
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    name string
    The name of the VPC.
    tags {[key: string]: string}
    Tags of the VPC.
    vpcId string
    ID of the resource.
    assistant_cidrs Sequence[str]
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    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).
    create_time str
    Creation time of VPC.
    default_route_table_id str
    Default route table id, which created automatically after VPC create.
    dns_servers Sequence[str]
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    docker_assistant_cidrs Sequence[str]
    List of Docker Assistant CIDR.
    is_default bool
    Indicates whether it is the default VPC for this region.
    is_multicast bool
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    name str
    The name of the VPC.
    tags Mapping[str, str]
    Tags of the VPC.
    vpc_id str
    ID of the resource.
    assistantCidrs List<String>
    List of Assistant CIDR, NOTE: Only NORMAL typed CIDRs included, check the Docker CIDR by readonly assistant_docker_cidrs.
    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).
    createTime String
    Creation time of VPC.
    defaultRouteTableId String
    Default route table id, which created automatically after VPC create.
    dnsServers List<String>
    The DNS server list of the VPC. And you can specify 0 to 5 servers to this list.
    dockerAssistantCidrs List<String>
    List of Docker Assistant CIDR.
    isDefault Boolean
    Indicates whether it is the default VPC for this region.
    isMulticast Boolean
    Indicates whether VPC multicast is enabled. The default value is 'true'.
    name String
    The name of the VPC.
    tags Map<String>
    Tags of the VPC.
    vpcId String
    ID of the resource.

    Import

    Vpc instance can be imported, e.g.

    $ pulumi import tencentcloud:index/vpc:Vpc test vpc-id
    

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

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack