tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack
tencentcloud.getSubnet
Explore with Pulumi AI
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 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({
subnetId: "subnet-ezgfompo",
vpcId: "vpc-ha5l97e3",
});
import pulumi
import pulumi_tencentcloud as tencentcloud
subnet = tencentcloud.get_subnet(subnet_id="subnet-ezgfompo",
vpc_id="vpc-ha5l97e3")
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{
SubnetId: "subnet-ezgfompo",
VpcId: "vpc-ha5l97e3",
}, 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()
{
SubnetId = "subnet-ezgfompo",
VpcId = "vpc-ha5l97e3",
});
});
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()
.subnetId("subnet-ezgfompo")
.vpcId("vpc-ha5l97e3")
.build());
}
}
variables:
subnet:
fn::invoke:
function: tencentcloud:getSubnet
arguments:
subnetId: subnet-ezgfompo
vpcId: vpc-ha5l97e3
Query method 2
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const subnet = tencentcloud.getSubnet({
cdcId: "cluster-lchwgxhs",
subnetId: "subnet-ezgfompo",
vpcId: "vpc-ha5l97e3",
});
import pulumi
import pulumi_tencentcloud as tencentcloud
subnet = tencentcloud.get_subnet(cdc_id="cluster-lchwgxhs",
subnet_id="subnet-ezgfompo",
vpc_id="vpc-ha5l97e3")
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{
CdcId: pulumi.StringRef("cluster-lchwgxhs"),
SubnetId: "subnet-ezgfompo",
VpcId: "vpc-ha5l97e3",
}, 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()
{
CdcId = "cluster-lchwgxhs",
SubnetId = "subnet-ezgfompo",
VpcId = "vpc-ha5l97e3",
});
});
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()
.cdcId("cluster-lchwgxhs")
.subnetId("subnet-ezgfompo")
.vpcId("vpc-ha5l97e3")
.build());
}
}
variables:
subnet:
fn::invoke:
function: tencentcloud:getSubnet
arguments:
cdcId: cluster-lchwgxhs
subnetId: subnet-ezgfompo
vpcId: vpc-ha5l97e3
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 dictionary
The 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
tencentcloud
Terraform Provider.
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack