OpenStack v5.0.3 published on Wednesday, Feb 12, 2025 by Pulumi
openstack.networking.getSubnetIdsV2
Explore with Pulumi AI
Use this data source to get a list of Openstack Subnet IDs matching the specified criteria.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const subnets = openstack.networking.getSubnetIdsV2({
    nameRegex: "public",
    tags: ["public"],
});
import pulumi
import pulumi_openstack as openstack
subnets = openstack.networking.get_subnet_ids_v2(name_regex="public",
    tags=["public"])
package main
import (
	"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/networking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := networking.GetSubnetIdsV2(ctx, &networking.GetSubnetIdsV2Args{
			NameRegex: pulumi.StringRef("public"),
			Tags: []string{
				"public",
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() => 
{
    var subnets = OpenStack.Networking.GetSubnetIdsV2.Invoke(new()
    {
        NameRegex = "public",
        Tags = new[]
        {
            "public",
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.NetworkingFunctions;
import com.pulumi.openstack.networking.inputs.GetSubnetIdsV2Args;
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 subnets = NetworkingFunctions.getSubnetIdsV2(GetSubnetIdsV2Args.builder()
            .nameRegex("public")
            .tags("public")
            .build());
    }
}
variables:
  subnets:
    fn::invoke:
      function: openstack:networking:getSubnetIdsV2
      arguments:
        nameRegex: public
        tags:
          - public
Using getSubnetIdsV2
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 getSubnetIdsV2(args: GetSubnetIdsV2Args, opts?: InvokeOptions): Promise<GetSubnetIdsV2Result>
function getSubnetIdsV2Output(args: GetSubnetIdsV2OutputArgs, opts?: InvokeOptions): Output<GetSubnetIdsV2Result>def get_subnet_ids_v2(cidr: Optional[str] = None,
                      description: Optional[str] = None,
                      dhcp_enabled: Optional[bool] = None,
                      dns_publish_fixed_ip: Optional[bool] = None,
                      gateway_ip: Optional[str] = None,
                      ip_version: Optional[int] = None,
                      ipv6_address_mode: Optional[str] = None,
                      ipv6_ra_mode: Optional[str] = None,
                      name: Optional[str] = None,
                      name_regex: Optional[str] = None,
                      network_id: Optional[str] = None,
                      region: Optional[str] = None,
                      sort_direction: Optional[str] = None,
                      sort_key: Optional[str] = None,
                      subnetpool_id: Optional[str] = None,
                      tags: Optional[Sequence[str]] = None,
                      tenant_id: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetSubnetIdsV2Result
def get_subnet_ids_v2_output(cidr: Optional[pulumi.Input[str]] = None,
                      description: Optional[pulumi.Input[str]] = None,
                      dhcp_enabled: Optional[pulumi.Input[bool]] = None,
                      dns_publish_fixed_ip: Optional[pulumi.Input[bool]] = None,
                      gateway_ip: Optional[pulumi.Input[str]] = None,
                      ip_version: Optional[pulumi.Input[int]] = None,
                      ipv6_address_mode: Optional[pulumi.Input[str]] = None,
                      ipv6_ra_mode: Optional[pulumi.Input[str]] = None,
                      name: Optional[pulumi.Input[str]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      network_id: Optional[pulumi.Input[str]] = None,
                      region: Optional[pulumi.Input[str]] = None,
                      sort_direction: Optional[pulumi.Input[str]] = None,
                      sort_key: Optional[pulumi.Input[str]] = None,
                      subnetpool_id: Optional[pulumi.Input[str]] = None,
                      tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                      tenant_id: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetSubnetIdsV2Result]func GetSubnetIdsV2(ctx *Context, args *GetSubnetIdsV2Args, opts ...InvokeOption) (*GetSubnetIdsV2Result, error)
func GetSubnetIdsV2Output(ctx *Context, args *GetSubnetIdsV2OutputArgs, opts ...InvokeOption) GetSubnetIdsV2ResultOutput> Note: This function is named GetSubnetIdsV2 in the Go SDK.
public static class GetSubnetIdsV2 
{
    public static Task<GetSubnetIdsV2Result> InvokeAsync(GetSubnetIdsV2Args args, InvokeOptions? opts = null)
    public static Output<GetSubnetIdsV2Result> Invoke(GetSubnetIdsV2InvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetSubnetIdsV2Result> getSubnetIdsV2(GetSubnetIdsV2Args args, InvokeOptions options)
public static Output<GetSubnetIdsV2Result> getSubnetIdsV2(GetSubnetIdsV2Args args, InvokeOptions options)
fn::invoke:
  function: openstack:networking/getSubnetIdsV2:getSubnetIdsV2
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Cidr string
 - The CIDR of the subnet.
 - Description string
 - Human-readable description of the subnet.
 - Dhcp
Enabled bool - If the subnet has DHCP enabled.
 - Dns
Publish boolFixed Ip  - If the subnet publishes DNS records.
 - Gateway
Ip string - The IP of the subnet's gateway.
 - Ip
Version int - The IP version of the subnet (either 4 or 6).
 - Ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful,dhcpv6-stateless, orslaac. - Ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are 
dhcpv6-stateful,dhcpv6-stateless, orslaac. - Name string
 - The name of the subnet.
 - Name
Regex string - Network
Id string - The ID of the network the subnet belongs to.
 - Region string
 - The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve subnet ids. If omitted, the
regionargument of the provider is used. - Sort
Direction string - Order the results in either 
ascordesc. Defaults to none. - Sort
Key string - Sort subnets based on a certain key. Defaults to none.
 - Subnetpool
Id string - The ID of the subnetpool associated with the subnet.
 - List<string>
 - The list of subnet tags to filter.
 - Tenant
Id string - The owner of the subnet.
 
- Cidr string
 - The CIDR of the subnet.
 - Description string
 - Human-readable description of the subnet.
 - Dhcp
Enabled bool - If the subnet has DHCP enabled.
 - Dns
Publish boolFixed Ip  - If the subnet publishes DNS records.
 - Gateway
Ip string - The IP of the subnet's gateway.
 - Ip
Version int - The IP version of the subnet (either 4 or 6).
 - Ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful,dhcpv6-stateless, orslaac. - Ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are 
dhcpv6-stateful,dhcpv6-stateless, orslaac. - Name string
 - The name of the subnet.
 - Name
Regex string - Network
Id string - The ID of the network the subnet belongs to.
 - Region string
 - The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve subnet ids. If omitted, the
regionargument of the provider is used. - Sort
Direction string - Order the results in either 
ascordesc. Defaults to none. - Sort
Key string - Sort subnets based on a certain key. Defaults to none.
 - Subnetpool
Id string - The ID of the subnetpool associated with the subnet.
 - []string
 - The list of subnet tags to filter.
 - Tenant
Id string - The owner of the subnet.
 
- cidr String
 - The CIDR of the subnet.
 - description String
 - Human-readable description of the subnet.
 - dhcp
Enabled Boolean - If the subnet has DHCP enabled.
 - dns
Publish BooleanFixed Ip  - If the subnet publishes DNS records.
 - gateway
Ip String - The IP of the subnet's gateway.
 - ip
Version Integer - The IP version of the subnet (either 4 or 6).
 - ipv6Address
Mode String - The IPv6 address mode. Valid values are
dhcpv6-stateful,dhcpv6-stateless, orslaac. - ipv6Ra
Mode String - The IPv6 Router Advertisement mode. Valid values
are 
dhcpv6-stateful,dhcpv6-stateless, orslaac. - name String
 - The name of the subnet.
 - name
Regex String - network
Id String - The ID of the network the subnet belongs to.
 - region String
 - The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve subnet ids. If omitted, the
regionargument of the provider is used. - sort
Direction String - Order the results in either 
ascordesc. Defaults to none. - sort
Key String - Sort subnets based on a certain key. Defaults to none.
 - subnetpool
Id String - The ID of the subnetpool associated with the subnet.
 - List<String>
 - The list of subnet tags to filter.
 - tenant
Id String - The owner of the subnet.
 
- cidr string
 - The CIDR of the subnet.
 - description string
 - Human-readable description of the subnet.
 - dhcp
Enabled boolean - If the subnet has DHCP enabled.
 - dns
Publish booleanFixed Ip  - If the subnet publishes DNS records.
 - gateway
Ip string - The IP of the subnet's gateway.
 - ip
Version number - The IP version of the subnet (either 4 or 6).
 - ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful,dhcpv6-stateless, orslaac. - ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are 
dhcpv6-stateful,dhcpv6-stateless, orslaac. - name string
 - The name of the subnet.
 - name
Regex string - network
Id string - The ID of the network the subnet belongs to.
 - region string
 - The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve subnet ids. If omitted, the
regionargument of the provider is used. - sort
Direction string - Order the results in either 
ascordesc. Defaults to none. - sort
Key string - Sort subnets based on a certain key. Defaults to none.
 - subnetpool
Id string - The ID of the subnetpool associated with the subnet.
 - string[]
 - The list of subnet tags to filter.
 - tenant
Id string - The owner of the subnet.
 
- cidr str
 - The CIDR of the subnet.
 - description str
 - Human-readable description of the subnet.
 - dhcp_
enabled bool - If the subnet has DHCP enabled.
 - dns_
publish_ boolfixed_ ip  - If the subnet publishes DNS records.
 - gateway_
ip str - The IP of the subnet's gateway.
 - ip_
version int - The IP version of the subnet (either 4 or 6).
 - ipv6_
address_ strmode  - The IPv6 address mode. Valid values are
dhcpv6-stateful,dhcpv6-stateless, orslaac. - ipv6_
ra_ strmode  - The IPv6 Router Advertisement mode. Valid values
are 
dhcpv6-stateful,dhcpv6-stateless, orslaac. - name str
 - The name of the subnet.
 - name_
regex str - network_
id str - The ID of the network the subnet belongs to.
 - region str
 - The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve subnet ids. If omitted, the
regionargument of the provider is used. - sort_
direction str - Order the results in either 
ascordesc. Defaults to none. - sort_
key str - Sort subnets based on a certain key. Defaults to none.
 - subnetpool_
id str - The ID of the subnetpool associated with the subnet.
 - Sequence[str]
 - The list of subnet tags to filter.
 - tenant_
id str - The owner of the subnet.
 
- cidr String
 - The CIDR of the subnet.
 - description String
 - Human-readable description of the subnet.
 - dhcp
Enabled Boolean - If the subnet has DHCP enabled.
 - dns
Publish BooleanFixed Ip  - If the subnet publishes DNS records.
 - gateway
Ip String - The IP of the subnet's gateway.
 - ip
Version Number - The IP version of the subnet (either 4 or 6).
 - ipv6Address
Mode String - The IPv6 address mode. Valid values are
dhcpv6-stateful,dhcpv6-stateless, orslaac. - ipv6Ra
Mode String - The IPv6 Router Advertisement mode. Valid values
are 
dhcpv6-stateful,dhcpv6-stateless, orslaac. - name String
 - The name of the subnet.
 - name
Regex String - network
Id String - The ID of the network the subnet belongs to.
 - region String
 - The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve subnet ids. If omitted, the
regionargument of the provider is used. - sort
Direction String - Order the results in either 
ascordesc. Defaults to none. - sort
Key String - Sort subnets based on a certain key. Defaults to none.
 - subnetpool
Id String - The ID of the subnetpool associated with the subnet.
 - List<String>
 - The list of subnet tags to filter.
 - tenant
Id String - The owner of the subnet.
 
getSubnetIdsV2 Result
The following output properties are available:
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids List<string>
 - Ipv6Ra
Mode string - Region string
 - Cidr string
 - Description string
 - Dhcp
Enabled bool - Dns
Publish boolFixed Ip  - Gateway
Ip string - Ip
Version int - Ipv6Address
Mode string - Name string
 - Name
Regex string - Network
Id string - Sort
Direction string - Sort
Key string - Subnetpool
Id string - List<string>
 - Tenant
Id string 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Ids []string
 - Ipv6Ra
Mode string - Region string
 - Cidr string
 - Description string
 - Dhcp
Enabled bool - Dns
Publish boolFixed Ip  - Gateway
Ip string - Ip
Version int - Ipv6Address
Mode string - Name string
 - Name
Regex string - Network
Id string - Sort
Direction string - Sort
Key string - Subnetpool
Id string - []string
 - Tenant
Id string 
- id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - ipv6Ra
Mode String - region String
 - cidr String
 - description String
 - dhcp
Enabled Boolean - dns
Publish BooleanFixed Ip  - gateway
Ip String - ip
Version Integer - ipv6Address
Mode String - name String
 - name
Regex String - network
Id String - sort
Direction String - sort
Key String - subnetpool
Id String - List<String>
 - tenant
Id String 
- id string
 - The provider-assigned unique ID for this managed resource.
 - ids string[]
 - ipv6Ra
Mode string - region string
 - cidr string
 - description string
 - dhcp
Enabled boolean - dns
Publish booleanFixed Ip  - gateway
Ip string - ip
Version number - ipv6Address
Mode string - name string
 - name
Regex string - network
Id string - sort
Direction string - sort
Key string - subnetpool
Id string - string[]
 - tenant
Id string 
- id str
 - The provider-assigned unique ID for this managed resource.
 - ids Sequence[str]
 - ipv6_
ra_ strmode  - region str
 - cidr str
 - description str
 - dhcp_
enabled bool - dns_
publish_ boolfixed_ ip  - gateway_
ip str - ip_
version int - ipv6_
address_ strmode  - name str
 - name_
regex str - network_
id str - sort_
direction str - sort_
key str - subnetpool_
id str - Sequence[str]
 - tenant_
id str 
- id String
 - The provider-assigned unique ID for this managed resource.
 - ids List<String>
 - ipv6Ra
Mode String - region String
 - cidr String
 - description String
 - dhcp
Enabled Boolean - dns
Publish BooleanFixed Ip  - gateway
Ip String - ip
Version Number - ipv6Address
Mode String - name String
 - name
Regex String - network
Id String - sort
Direction String - sort
Key String - subnetpool
Id String - List<String>
 - tenant
Id String 
Package Details
- Repository
 - OpenStack pulumi/pulumi-openstack
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
openstackTerraform Provider.