title: "getSubnets" title_tag: "huaweicloud.Vpc.getSubnets" meta_desc: "Documentation for the huaweicloud.Vpc.getSubnets function with examples, input properties, output properties, and supporting types." layout: api no_edit_this_page: true


Use this data source to get a list of VPC subnet.

Attributes Reference

The following attributes are exported:

  • id - Indicates a data source ID.
  • subnets - Indicates a list of all subnets found. Structure is documented below.

The subnets block supports:

  • id - Indicates the ID of the subnet.
  • name - Indicates the name of the subnet.
  • description - Indicates the description of the subnet.
  • cidr - Indicates the cidr block of the subnet.
  • status - Indicates the current status of the subnet.
  • vpc_id - Indicates the Id of the VPC that the subnet belongs to.
  • gateway_ip - Indicates the subnet gateway address of the subnet.
  • primary_dns - Indicates the IP address of DNS server 1 on the subnet.
  • secondary_dns - Indicates the IP address of DNS server 2 on the subnet.
  • availability_zone - Indicates the availability zone (AZ) to which the subnet belongs to.
  • dhcp_enable - Indicates whether the DHCP is enabled.
  • dns_list - Indicates The IP address list of DNS servers on the subnet.
  • ipv4_subnet_id - Indicates the ID of the IPv4 subnet (Native OpenStack API).
  • ipv6_enable - Indicates whether the IPv6 is enabled.
  • ipv6_subnet_id - Indicates the ID of the IPv6 subnet (Native OpenStack API).
  • ipv6_cidr - Indicates the IPv6 subnet CIDR block.
  • ipv6_gateway - Indicates the IPv6 subnet gateway.
  • tags - Indicates the key/value pairs which associated with the subnet.

Using getSubnets {#using}

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 getSubnets(args: GetSubnetsArgs, opts?: InvokeOptions): Promise<GetSubnetsResult>
function getSubnetsOutput(args: GetSubnetsOutputArgs, opts?: InvokeOptions): Output<GetSubnetsResult>
def get_subnets(availability_zone: Optional[str] = None,
                cidr: Optional[str] = None,
                gateway_ip: Optional[str] = None,
                id: Optional[str] = None,
                name: Optional[str] = None,
                primary_dns: Optional[str] = None,
                region: Optional[str] = None,
                secondary_dns: Optional[str] = None,
                status: Optional[str] = None,
                tags: Optional[Mapping[str, str]] = None,
                vpc_id: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetSubnetsResult
def get_subnets_output(availability_zone: Optional[pulumi.Input[str]] = None,
                cidr: Optional[pulumi.Input[str]] = None,
                gateway_ip: Optional[pulumi.Input[str]] = None,
                id: Optional[pulumi.Input[str]] = None,
                name: Optional[pulumi.Input[str]] = None,
                primary_dns: Optional[pulumi.Input[str]] = None,
                region: Optional[pulumi.Input[str]] = None,
                secondary_dns: Optional[pulumi.Input[str]] = None,
                status: Optional[pulumi.Input[str]] = None,
                tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                vpc_id: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetSubnetsResult]
func GetSubnets(ctx *Context, args *GetSubnetsArgs, opts ...InvokeOption) (*GetSubnetsResult, error)
func GetSubnetsOutput(ctx *Context, args *GetSubnetsOutputArgs, opts ...InvokeOption) GetSubnetsResultOutput

> Note: This function is named GetSubnets in the Go SDK.

public static class GetSubnets 
{
    public static Task<GetSubnetsResult> InvokeAsync(GetSubnetsArgs args, InvokeOptions? opts = null)
    public static Output<GetSubnetsResult> Invoke(GetSubnetsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSubnetsResult> getSubnets(GetSubnetsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: huaweicloud:Vpc/getSubnets:getSubnets
  Arguments:
    # Arguments dictionary

The following arguments are supported:

AvailabilityZone string

Specifies the availability zone (AZ) to which the desired subnet belongs to.

Cidr string

Specifies the network segment of desired subnet. The value must be in CIDR format.

GatewayIp string

Specifies the subnet gateway address of desired subnet.

Id string
  • Specifies the id of the desired subnet.
Name string

Specifies the name of the desired subnet.

PrimaryDns string

Specifies the IP address of DNS server 1 on the desired subnet.

Region string

Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.

SecondaryDns string

Specifies the IP address of DNS server 2 on the desired subnet.

Status string

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

Tags Dictionary<string, string>

Specifies the included key/value pairs which associated with the desired subnet.

VpcId string

Specifies the id of the VPC that the desired subnet belongs to.

AvailabilityZone string

Specifies the availability zone (AZ) to which the desired subnet belongs to.

Cidr string

Specifies the network segment of desired subnet. The value must be in CIDR format.

GatewayIp string

Specifies the subnet gateway address of desired subnet.

Id string
  • Specifies the id of the desired subnet.
Name string

Specifies the name of the desired subnet.

PrimaryDns string

Specifies the IP address of DNS server 1 on the desired subnet.

Region string

Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.

SecondaryDns string

Specifies the IP address of DNS server 2 on the desired subnet.

Status string

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

Tags map[string]string

Specifies the included key/value pairs which associated with the desired subnet.

VpcId string

Specifies the id of the VPC that the desired subnet belongs to.

availabilityZone String

Specifies the availability zone (AZ) to which the desired subnet belongs to.

cidr String

Specifies the network segment of desired subnet. The value must be in CIDR format.

gatewayIp String

Specifies the subnet gateway address of desired subnet.

id String
  • Specifies the id of the desired subnet.
name String

Specifies the name of the desired subnet.

primaryDns String

Specifies the IP address of DNS server 1 on the desired subnet.

region String

Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.

secondaryDns String

Specifies the IP address of DNS server 2 on the desired subnet.

status String

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

tags Map<String,String>

Specifies the included key/value pairs which associated with the desired subnet.

vpcId String

Specifies the id of the VPC that the desired subnet belongs to.

availabilityZone string

Specifies the availability zone (AZ) to which the desired subnet belongs to.

cidr string

Specifies the network segment of desired subnet. The value must be in CIDR format.

gatewayIp string

Specifies the subnet gateway address of desired subnet.

id string
  • Specifies the id of the desired subnet.
name string

Specifies the name of the desired subnet.

primaryDns string

Specifies the IP address of DNS server 1 on the desired subnet.

region string

Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.

secondaryDns string

Specifies the IP address of DNS server 2 on the desired subnet.

status string

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

tags {[key: string]: string}

Specifies the included key/value pairs which associated with the desired subnet.

vpcId string

Specifies the id of the VPC that the desired subnet belongs to.

availability_zone str

Specifies the availability zone (AZ) to which the desired subnet belongs to.

cidr str

Specifies the network segment of desired subnet. The value must be in CIDR format.

gateway_ip str

Specifies the subnet gateway address of desired subnet.

id str
  • Specifies the id of the desired subnet.
name str

Specifies the name of the desired subnet.

primary_dns str

Specifies the IP address of DNS server 1 on the desired subnet.

region str

Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.

secondary_dns str

Specifies the IP address of DNS server 2 on the desired subnet.

status str

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

tags Mapping[str, str]

Specifies the included key/value pairs which associated with the desired subnet.

vpc_id str

Specifies the id of the VPC that the desired subnet belongs to.

availabilityZone String

Specifies the availability zone (AZ) to which the desired subnet belongs to.

cidr String

Specifies the network segment of desired subnet. The value must be in CIDR format.

gatewayIp String

Specifies the subnet gateway address of desired subnet.

id String
  • Specifies the id of the desired subnet.
name String

Specifies the name of the desired subnet.

primaryDns String

Specifies the IP address of DNS server 1 on the desired subnet.

region String

Specifies the region in which to obtain the subnet. If omitted, the provider-level region will be used.

secondaryDns String

Specifies the IP address of DNS server 2 on the desired subnet.

status String

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

tags Map<String>

Specifies the included key/value pairs which associated with the desired subnet.

vpcId String

Specifies the id of the VPC that the desired subnet belongs to.

getSubnets Result {#result}

The following output properties are available:

Id string
Region string
Subnets List<GetSubnetsSubnet>
AvailabilityZone string
Cidr string
GatewayIp string
Name string
PrimaryDns string
SecondaryDns string
Status string
Tags Dictionary<string, string>
VpcId string
Id string
Region string
Subnets []GetSubnetsSubnet
AvailabilityZone string
Cidr string
GatewayIp string
Name string
PrimaryDns string
SecondaryDns string
Status string
Tags map[string]string
VpcId string
id String
region String
subnets List<GetSubnetsSubnet>
availabilityZone String
cidr String
gatewayIp String
name String
primaryDns String
secondaryDns String
status String
tags Map<String,String>
vpcId String
id string
region string
subnets GetSubnetsSubnet[]
availabilityZone string
cidr string
gatewayIp string
name string
primaryDns string
secondaryDns string
status string
tags {[key: string]: string}
vpcId string
id str
region str
subnets GetSubnetsSubnet]
availability_zone str
cidr str
gateway_ip str
name str
primary_dns str
secondary_dns str
status str
tags Mapping[str, str]
vpc_id str
id String
region String
subnets List<Property Map>
availabilityZone String
cidr String
gatewayIp String
name String
primaryDns String
secondaryDns String
status String
tags Map<String>
vpcId String

Supporting Types

GetSubnetsSubnet

AvailabilityZone string

Specifies the availability zone (AZ) to which the desired subnet belongs to.

Cidr string

Specifies the network segment of desired subnet. The value must be in CIDR format.

Description string
DhcpEnable bool
DnsLists List<string>
GatewayIp string

Specifies the subnet gateway address of desired subnet.

Id string
  • Specifies the id of the desired subnet.
Ipv4SubnetId string
Ipv6Cidr string
Ipv6Enable bool
Ipv6Gateway string
Ipv6SubnetId string
Name string

Specifies the name of the desired subnet.

PrimaryDns string

Specifies the IP address of DNS server 1 on the desired subnet.

SecondaryDns string

Specifies the IP address of DNS server 2 on the desired subnet.

Status string

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

SubnetId string
Tags Dictionary<string, string>

Specifies the included key/value pairs which associated with the desired subnet.

VpcId string

Specifies the id of the VPC that the desired subnet belongs to.

AvailabilityZone string

Specifies the availability zone (AZ) to which the desired subnet belongs to.

Cidr string

Specifies the network segment of desired subnet. The value must be in CIDR format.

Description string
DhcpEnable bool
DnsLists []string
GatewayIp string

Specifies the subnet gateway address of desired subnet.

Id string
  • Specifies the id of the desired subnet.
Ipv4SubnetId string
Ipv6Cidr string
Ipv6Enable bool
Ipv6Gateway string
Ipv6SubnetId string
Name string

Specifies the name of the desired subnet.

PrimaryDns string

Specifies the IP address of DNS server 1 on the desired subnet.

SecondaryDns string

Specifies the IP address of DNS server 2 on the desired subnet.

Status string

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

SubnetId string
Tags map[string]string

Specifies the included key/value pairs which associated with the desired subnet.

VpcId string

Specifies the id of the VPC that the desired subnet belongs to.

availabilityZone String

Specifies the availability zone (AZ) to which the desired subnet belongs to.

cidr String

Specifies the network segment of desired subnet. The value must be in CIDR format.

description String
dhcpEnable Boolean
dnsLists List<String>
gatewayIp String

Specifies the subnet gateway address of desired subnet.

id String
  • Specifies the id of the desired subnet.
ipv4SubnetId String
ipv6Cidr String
ipv6Enable Boolean
ipv6Gateway String
ipv6SubnetId String
name String

Specifies the name of the desired subnet.

primaryDns String

Specifies the IP address of DNS server 1 on the desired subnet.

secondaryDns String

Specifies the IP address of DNS server 2 on the desired subnet.

status String

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

subnetId String
tags Map<String,String>

Specifies the included key/value pairs which associated with the desired subnet.

vpcId String

Specifies the id of the VPC that the desired subnet belongs to.

availabilityZone string

Specifies the availability zone (AZ) to which the desired subnet belongs to.

cidr string

Specifies the network segment of desired subnet. The value must be in CIDR format.

description string
dhcpEnable boolean
dnsLists string[]
gatewayIp string

Specifies the subnet gateway address of desired subnet.

id string
  • Specifies the id of the desired subnet.
ipv4SubnetId string
ipv6Cidr string
ipv6Enable boolean
ipv6Gateway string
ipv6SubnetId string
name string

Specifies the name of the desired subnet.

primaryDns string

Specifies the IP address of DNS server 1 on the desired subnet.

secondaryDns string

Specifies the IP address of DNS server 2 on the desired subnet.

status string

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

subnetId string
tags {[key: string]: string}

Specifies the included key/value pairs which associated with the desired subnet.

vpcId string

Specifies the id of the VPC that the desired subnet belongs to.

availability_zone str

Specifies the availability zone (AZ) to which the desired subnet belongs to.

cidr str

Specifies the network segment of desired subnet. The value must be in CIDR format.

description str
dhcp_enable bool
dns_lists Sequence[str]
gateway_ip str

Specifies the subnet gateway address of desired subnet.

id str
  • Specifies the id of the desired subnet.
ipv4_subnet_id str
ipv6_cidr str
ipv6_enable bool
ipv6_gateway str
ipv6_subnet_id str
name str

Specifies the name of the desired subnet.

primary_dns str

Specifies the IP address of DNS server 1 on the desired subnet.

secondary_dns str

Specifies the IP address of DNS server 2 on the desired subnet.

status str

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

subnet_id str
tags Mapping[str, str]

Specifies the included key/value pairs which associated with the desired subnet.

vpc_id str

Specifies the id of the VPC that the desired subnet belongs to.

availabilityZone String

Specifies the availability zone (AZ) to which the desired subnet belongs to.

cidr String

Specifies the network segment of desired subnet. The value must be in CIDR format.

description String
dhcpEnable Boolean
dnsLists List<String>
gatewayIp String

Specifies the subnet gateway address of desired subnet.

id String
  • Specifies the id of the desired subnet.
ipv4SubnetId String
ipv6Cidr String
ipv6Enable Boolean
ipv6Gateway String
ipv6SubnetId String
name String

Specifies the name of the desired subnet.

primaryDns String

Specifies the IP address of DNS server 1 on the desired subnet.

secondaryDns String

Specifies the IP address of DNS server 2 on the desired subnet.

status String

Specifies the current status of the desired subnet. the value can be ACTIVE, DOWN, UNKNOWN, or ERROR.

subnetId String
tags Map<String>

Specifies the included key/value pairs which associated with the desired subnet.

vpcId String

Specifies the id of the VPC that the desired subnet belongs to.

Package Details

Repository
https://github.com/huaweicloud/pulumi-huaweicloud
License
Apache-2.0
Notes

This Pulumi package is based on the huaweicloud Terraform Provider.