Viewing docs for tencentcloud 1.82.73
published on Friday, Mar 6, 2026 by tencentcloudstack
published on Friday, Mar 6, 2026 by tencentcloudstack
Viewing docs for tencentcloud 1.82.73
published on Friday, Mar 6, 2026 by tencentcloudstack
published on Friday, Mar 6, 2026 by tencentcloudstack
Provides details about a specific VPC subnet.
This resource can prove useful when a module accepts a subnet id as an input variable and needs to, for example, determine the id of the VPC that the subnet belongs to.
NOTE: It has been deprecated and replaced by tencentcloud_vpc_subnets.
Example Usage
Query method 1
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const subnet = tencentcloud.getSubnet({
vpcId: "vpc-ha5l97e3",
subnetId: "subnet-ezgfompo",
});
import pulumi
import pulumi_tencentcloud as tencentcloud
subnet = tencentcloud.get_subnet(vpc_id="vpc-ha5l97e3",
subnet_id="subnet-ezgfompo")
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.LookupSubnet(ctx, &tencentcloud.LookupSubnetArgs{
VpcId: "vpc-ha5l97e3",
SubnetId: "subnet-ezgfompo",
}, nil)
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 subnet = Tencentcloud.GetSubnet.Invoke(new()
{
VpcId = "vpc-ha5l97e3",
SubnetId = "subnet-ezgfompo",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.TencentcloudFunctions;
import com.pulumi.tencentcloud.inputs.GetSubnetArgs;
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) {
final var subnet = TencentcloudFunctions.getSubnet(GetSubnetArgs.builder()
.vpcId("vpc-ha5l97e3")
.subnetId("subnet-ezgfompo")
.build());
}
}
variables:
subnet:
fn::invoke:
function: tencentcloud:getSubnet
arguments:
vpcId: vpc-ha5l97e3
subnetId: subnet-ezgfompo
Query method 2
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const subnet = tencentcloud.getSubnet({
vpcId: "vpc-ha5l97e3",
subnetId: "subnet-ezgfompo",
cdcId: "cluster-lchwgxhs",
});
import pulumi
import pulumi_tencentcloud as tencentcloud
subnet = tencentcloud.get_subnet(vpc_id="vpc-ha5l97e3",
subnet_id="subnet-ezgfompo",
cdc_id="cluster-lchwgxhs")
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.LookupSubnet(ctx, &tencentcloud.LookupSubnetArgs{
VpcId: "vpc-ha5l97e3",
SubnetId: "subnet-ezgfompo",
CdcId: pulumi.StringRef("cluster-lchwgxhs"),
}, nil)
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 subnet = Tencentcloud.GetSubnet.Invoke(new()
{
VpcId = "vpc-ha5l97e3",
SubnetId = "subnet-ezgfompo",
CdcId = "cluster-lchwgxhs",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.TencentcloudFunctions;
import com.pulumi.tencentcloud.inputs.GetSubnetArgs;
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) {
final var subnet = TencentcloudFunctions.getSubnet(GetSubnetArgs.builder()
.vpcId("vpc-ha5l97e3")
.subnetId("subnet-ezgfompo")
.cdcId("cluster-lchwgxhs")
.build());
}
}
variables:
subnet:
fn::invoke:
function: tencentcloud:getSubnet
arguments:
vpcId: vpc-ha5l97e3
subnetId: subnet-ezgfompo
cdcId: cluster-lchwgxhs
Using getSubnet
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getSubnet(args: GetSubnetArgs, opts?: InvokeOptions): Promise<GetSubnetResult>
function getSubnetOutput(args: GetSubnetOutputArgs, opts?: InvokeOptions): Output<GetSubnetResult>def get_subnet(cdc_id: Optional[str] = None,
id: Optional[str] = None,
subnet_id: Optional[str] = None,
vpc_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSubnetResult
def get_subnet_output(cdc_id: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
subnet_id: Optional[pulumi.Input[str]] = None,
vpc_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSubnetResult]func LookupSubnet(ctx *Context, args *LookupSubnetArgs, opts ...InvokeOption) (*LookupSubnetResult, error)
func LookupSubnetOutput(ctx *Context, args *LookupSubnetOutputArgs, opts ...InvokeOption) LookupSubnetResultOutput> Note: This function is named LookupSubnet in the Go SDK.
public static class GetSubnet
{
public static Task<GetSubnetResult> InvokeAsync(GetSubnetArgs args, InvokeOptions? opts = null)
public static Output<GetSubnetResult> Invoke(GetSubnetInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetSubnetResult> getSubnet(GetSubnetArgs args, InvokeOptions options)
public static Output<GetSubnetResult> getSubnet(GetSubnetArgs args, InvokeOptions options)
fn::invoke:
function: tencentcloud:index/getSubnet:getSubnet
arguments:
# arguments dictionaryThe following arguments are supported:
getSubnet Result
The following output properties are available:
- Availability
Zone string - The AZ for the subnet.
- Cdc
Id string - Cidr
Block string - The CIDR block of the Subnet.
- Id string
- Name string
- The name for the Subnet.
- Route
Table stringId - The Route Table ID.
- Subnet
Id string - Vpc
Id string
- Availability
Zone string - The AZ for the subnet.
- Cdc
Id string - Cidr
Block string - The CIDR block of the Subnet.
- Id string
- Name string
- The name for the Subnet.
- Route
Table stringId - The Route Table ID.
- Subnet
Id string - Vpc
Id string
- availability
Zone String - The AZ for the subnet.
- cdc
Id String - cidr
Block String - The CIDR block of the Subnet.
- id String
- name String
- The name for the Subnet.
- route
Table StringId - The Route Table ID.
- subnet
Id String - vpc
Id String
- availability
Zone string - The AZ for the subnet.
- cdc
Id string - cidr
Block string - The CIDR block of the Subnet.
- id string
- name string
- The name for the Subnet.
- route
Table stringId - The Route Table ID.
- subnet
Id string - vpc
Id string
- availability_
zone str - The AZ for the subnet.
- cdc_
id str - cidr_
block str - The CIDR block of the Subnet.
- id str
- name str
- The name for the Subnet.
- route_
table_ strid - The Route Table ID.
- subnet_
id str - vpc_
id str
- availability
Zone String - The AZ for the subnet.
- cdc
Id String - cidr
Block String - The CIDR block of the Subnet.
- id String
- name String
- The name for the Subnet.
- route
Table StringId - The Route Table ID.
- subnet
Id String - vpc
Id String
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloudTerraform Provider.
Viewing docs for tencentcloud 1.82.73
published on Friday, Mar 6, 2026 by tencentcloudstack
published on Friday, Mar 6, 2026 by tencentcloudstack
