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:
-
Availability
Zone 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.
-
Gateway
Ip 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.
-
Primary
Dns 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.
-
Secondary
Dns 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.
- Dictionary<string, string>
Specifies the included key/value pairs which associated with the desired subnet.
-
Vpc
Id string Specifies the id of the VPC that the desired subnet belongs to.
-
Availability
Zone 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.
-
Gateway
Ip 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.
-
Primary
Dns 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.
-
Secondary
Dns 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.
- map[string]string
Specifies the included key/value pairs which associated with the desired subnet.
-
Vpc
Id string Specifies the id of the VPC that the desired subnet belongs to.
-
availability
Zone 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.
-
gateway
Ip 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.
-
primary
Dns 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.
-
secondary
Dns 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.
- Map<String,String>
Specifies the included key/value pairs which associated with the desired subnet.
-
vpc
Id String Specifies the id of the VPC that the desired subnet belongs to.
-
availability
Zone 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.
-
gateway
Ip 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.
-
primary
Dns 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.
-
secondary
Dns 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.
- {[key: string]: string}
Specifies the included key/value pairs which associated with the desired subnet.
-
vpc
Id 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.
- 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.
-
availability
Zone 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.
-
gateway
Ip 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.
-
primary
Dns 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.
-
secondary
Dns 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.
- Map<String>
Specifies the included key/value pairs which associated with the desired subnet.
-
vpc
Id 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<Get
Subnets Subnet> -
Availability
Zone string - Cidr string
-
Gateway
Ip string - Name string
-
Primary
Dns string -
Secondary
Dns string - Status string
- Dictionary<string, string>
-
Vpc
Id string
- Id string
- Region string
-
Subnets
[]Get
Subnets Subnet -
Availability
Zone string - Cidr string
-
Gateway
Ip string - Name string
-
Primary
Dns string -
Secondary
Dns string - Status string
- map[string]string
-
Vpc
Id string
- id String
- region String
-
subnets
List<Get
Subnets Subnet> -
availability
Zone String - cidr String
-
gateway
Ip String - name String
-
primary
Dns String -
secondary
Dns String - status String
- Map<String,String>
-
vpc
Id String
- id string
- region string
-
subnets
Get
Subnets Subnet[] -
availability
Zone string - cidr string
-
gateway
Ip string - name string
-
primary
Dns string -
secondary
Dns string - status string
- {[key: string]: string}
-
vpc
Id string
- id str
- region str
-
subnets
Get
Subnets Subnet] -
availability_
zone str - cidr str
-
gateway_
ip str - name str
-
primary_
dns str -
secondary_
dns str - status str
- Mapping[str, str]
-
vpc_
id str
- id String
- region String
- subnets List<Property Map>
-
availability
Zone String - cidr String
-
gateway
Ip String - name String
-
primary
Dns String -
secondary
Dns String - status String
- Map<String>
-
vpc
Id String
Supporting Types
GetSubnetsSubnet
-
Availability
Zone 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
-
Dhcp
Enable bool -
Dns
Lists List<string> -
Gateway
Ip string Specifies the subnet gateway address of desired subnet.
- Id string
- Specifies the id of the desired subnet.
-
Ipv4Subnet
Id string - Ipv6Cidr string
- Ipv6Enable bool
- Ipv6Gateway string
-
Ipv6Subnet
Id string - Name string
Specifies the name of the desired subnet.
-
Primary
Dns string Specifies the IP address of DNS server 1 on the desired subnet.
-
Secondary
Dns 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.
-
Subnet
Id string - Dictionary<string, string>
Specifies the included key/value pairs which associated with the desired subnet.
-
Vpc
Id string Specifies the id of the VPC that the desired subnet belongs to.
-
Availability
Zone 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
-
Dhcp
Enable bool -
Dns
Lists []string -
Gateway
Ip string Specifies the subnet gateway address of desired subnet.
- Id string
- Specifies the id of the desired subnet.
-
Ipv4Subnet
Id string - Ipv6Cidr string
- Ipv6Enable bool
- Ipv6Gateway string
-
Ipv6Subnet
Id string - Name string
Specifies the name of the desired subnet.
-
Primary
Dns string Specifies the IP address of DNS server 1 on the desired subnet.
-
Secondary
Dns 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.
-
Subnet
Id string - map[string]string
Specifies the included key/value pairs which associated with the desired subnet.
-
Vpc
Id string Specifies the id of the VPC that the desired subnet belongs to.
-
availability
Zone 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
-
dhcp
Enable Boolean -
dns
Lists List<String> -
gateway
Ip String Specifies the subnet gateway address of desired subnet.
- id String
- Specifies the id of the desired subnet.
-
ipv4Subnet
Id String - ipv6Cidr String
- ipv6Enable Boolean
- ipv6Gateway String
-
ipv6Subnet
Id String - name String
Specifies the name of the desired subnet.
-
primary
Dns String Specifies the IP address of DNS server 1 on the desired subnet.
-
secondary
Dns 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.
-
subnet
Id String - Map<String,String>
Specifies the included key/value pairs which associated with the desired subnet.
-
vpc
Id String Specifies the id of the VPC that the desired subnet belongs to.
-
availability
Zone 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
-
dhcp
Enable boolean -
dns
Lists string[] -
gateway
Ip string Specifies the subnet gateway address of desired subnet.
- id string
- Specifies the id of the desired subnet.
-
ipv4Subnet
Id string - ipv6Cidr string
- ipv6Enable boolean
- ipv6Gateway string
-
ipv6Subnet
Id string - name string
Specifies the name of the desired subnet.
-
primary
Dns string Specifies the IP address of DNS server 1 on the desired subnet.
-
secondary
Dns 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.
-
subnet
Id string - {[key: string]: string}
Specifies the included key/value pairs which associated with the desired subnet.
-
vpc
Id 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_ strid -
ipv6_
cidr str -
ipv6_
enable bool -
ipv6_
gateway str -
ipv6_
subnet_ strid - 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 - 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.
-
availability
Zone 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
-
dhcp
Enable Boolean -
dns
Lists List<String> -
gateway
Ip String Specifies the subnet gateway address of desired subnet.
- id String
- Specifies the id of the desired subnet.
-
ipv4Subnet
Id String - ipv6Cidr String
- ipv6Enable Boolean
- ipv6Gateway String
-
ipv6Subnet
Id String - name String
Specifies the name of the desired subnet.
-
primary
Dns String Specifies the IP address of DNS server 1 on the desired subnet.
-
secondary
Dns 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.
-
subnet
Id String - Map<String>
Specifies the included key/value pairs which associated with the desired subnet.
-
vpc
Id 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.