GetSubnet

Use this data source to get the ID of an available OpenStack subnet.

Example Usage

using Pulumi;
using OpenStack = Pulumi.OpenStack;

class MyStack : Stack
{
    public MyStack()
    {
        var subnet1 = Output.Create(OpenStack.Networking.GetSubnet.InvokeAsync(new OpenStack.Networking.GetSubnetArgs
        {
            Name = "subnet_1",
        }));
    }

}

Coming soon!

import pulumi
import pulumi_openstack as openstack

subnet1 = openstack.networking.get_subnet(name="subnet_1")
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const subnet1 = pulumi.output(openstack.networking.getSubnet({
    name: "subnet_1",
}, { async: true }));

Using GetSubnet

function getSubnet(args: GetSubnetArgs, opts?: InvokeOptions): Promise<GetSubnetResult>
function  get_subnet(cidr=None, description=None, dhcp_disabled=None, dhcp_enabled=None, gateway_ip=None, ip_version=None, ipv6_address_mode=None, ipv6_ra_mode=None, name=None, network_id=None, region=None, subnet_id=None, subnetpool_id=None, tags=None, tenant_id=None, opts=None)
func LookupSubnet(ctx *Context, args *LookupSubnetArgs, opts ...InvokeOption) (*LookupSubnetResult, error)

Note: This function is named LookupSubnet in the Go SDK.

public static class GetSubnet {
    public static Task<GetSubnetResult> InvokeAsync(GetSubnetArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Cidr string

The CIDR of the subnet.

Description string

Human-readable description for the subnet.

DhcpDisabled bool

If the subnet has DHCP disabled.

DhcpEnabled bool

If the subnet has DHCP enabled.

GatewayIp string

The IP of the subnet’s gateway.

IpVersion int

The IP version of the subnet (either 4 or 6).

Ipv6AddressMode string

The IPv6 address mode. Valid values are dhcpv6-stateful, dhcpv6-stateless, or slaac.

Ipv6RaMode string

The IPv6 Router Advertisement mode. Valid values are dhcpv6-stateful, dhcpv6-stateless, or slaac.

Name string

The name of the subnet.

NetworkId 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 region argument of the provider is used.

SubnetId string

The ID of the subnet.

SubnetpoolId string

The ID of the subnetpool associated with the subnet.

Tags List<string>

The list of subnet tags to filter.

TenantId string

The owner of the subnet.

Cidr string

The CIDR of the subnet.

Description string

Human-readable description for the subnet.

DhcpDisabled bool

If the subnet has DHCP disabled.

DhcpEnabled bool

If the subnet has DHCP enabled.

GatewayIp string

The IP of the subnet’s gateway.

IpVersion int

The IP version of the subnet (either 4 or 6).

Ipv6AddressMode string

The IPv6 address mode. Valid values are dhcpv6-stateful, dhcpv6-stateless, or slaac.

Ipv6RaMode string

The IPv6 Router Advertisement mode. Valid values are dhcpv6-stateful, dhcpv6-stateless, or slaac.

Name string

The name of the subnet.

NetworkId 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 region argument of the provider is used.

SubnetId string

The ID of the subnet.

SubnetpoolId string

The ID of the subnetpool associated with the subnet.

Tags []string

The list of subnet tags to filter.

TenantId string

The owner of the subnet.

cidr string

The CIDR of the subnet.

description string

Human-readable description for the subnet.

dhcpDisabled boolean

If the subnet has DHCP disabled.

dhcpEnabled boolean

If the subnet has DHCP enabled.

gatewayIp string

The IP of the subnet’s gateway.

ipVersion number

The IP version of the subnet (either 4 or 6).

ipv6AddressMode string

The IPv6 address mode. Valid values are dhcpv6-stateful, dhcpv6-stateless, or slaac.

ipv6RaMode string

The IPv6 Router Advertisement mode. Valid values are dhcpv6-stateful, dhcpv6-stateless, or slaac.

name string

The name of the subnet.

networkId 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 region argument of the provider is used.

subnetId string

The ID of the subnet.

subnetpoolId string

The ID of the subnetpool associated with the subnet.

tags string[]

The list of subnet tags to filter.

tenantId string

The owner of the subnet.

cidr str

The CIDR of the subnet.

description str

Human-readable description for the subnet.

dhcp_disabled bool

If the subnet has DHCP disabled.

dhcp_enabled bool

If the subnet has DHCP enabled.

gateway_ip str

The IP of the subnet’s gateway.

ip_version float

The IP version of the subnet (either 4 or 6).

ipv6_address_mode str

The IPv6 address mode. Valid values are dhcpv6-stateful, dhcpv6-stateless, or slaac.

ipv6_ra_mode str

The IPv6 Router Advertisement mode. Valid values are dhcpv6-stateful, dhcpv6-stateless, or slaac.

name str

The name of the subnet.

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 region argument of the provider is used.

subnet_id str

The ID of the subnet.

subnetpool_id str

The ID of the subnetpool associated with the subnet.

tags List[str]

The list of subnet tags to filter.

tenant_id str

The owner of the subnet.

GetSubnet Result

The following output properties are available:

AllTags List<string>

A set of string tags applied on the subnet.

AllocationPools List<Pulumi.OpenStack.Networking.Outputs.GetSubnetAllocationPool>

Allocation pools of the subnet.

Cidr string
Description string
DnsNameservers List<string>

DNS Nameservers of the subnet.

EnableDhcp bool

Whether the subnet has DHCP enabled or not.

GatewayIp string
HostRoutes List<Pulumi.OpenStack.Networking.Outputs.GetSubnetHostRoute>

Host Routes of the subnet.

Id string

The provider-assigned unique ID for this managed resource.

IpVersion int
Ipv6AddressMode string
Ipv6RaMode string
Name string
NetworkId string
Region string

See Argument Reference above.

SubnetId string
SubnetpoolId string
TenantId string
DhcpDisabled bool
DhcpEnabled bool
Tags List<string>
AllTags []string

A set of string tags applied on the subnet.

AllocationPools []GetSubnetAllocationPool

Allocation pools of the subnet.

Cidr string
Description string
DnsNameservers []string

DNS Nameservers of the subnet.

EnableDhcp bool

Whether the subnet has DHCP enabled or not.

GatewayIp string
HostRoutes []GetSubnetHostRoute

Host Routes of the subnet.

Id string

The provider-assigned unique ID for this managed resource.

IpVersion int
Ipv6AddressMode string
Ipv6RaMode string
Name string
NetworkId string
Region string

See Argument Reference above.

SubnetId string
SubnetpoolId string
TenantId string
DhcpDisabled bool
DhcpEnabled bool
Tags []string
allTags string[]

A set of string tags applied on the subnet.

allocationPools GetSubnetAllocationPool[]

Allocation pools of the subnet.

cidr string
description string
dnsNameservers string[]

DNS Nameservers of the subnet.

enableDhcp boolean

Whether the subnet has DHCP enabled or not.

gatewayIp string
hostRoutes GetSubnetHostRoute[]

Host Routes of the subnet.

id string

The provider-assigned unique ID for this managed resource.

ipVersion number
ipv6AddressMode string
ipv6RaMode string
name string
networkId string
region string

See Argument Reference above.

subnetId string
subnetpoolId string
tenantId string
dhcpDisabled boolean
dhcpEnabled boolean
tags string[]
all_tags List[str]

A set of string tags applied on the subnet.

allocation_pools List[GetSubnetAllocationPool]

Allocation pools of the subnet.

cidr str
description str
dns_nameservers List[str]

DNS Nameservers of the subnet.

enable_dhcp bool

Whether the subnet has DHCP enabled or not.

gateway_ip str
host_routes List[GetSubnetHostRoute]

Host Routes of the subnet.

id str

The provider-assigned unique ID for this managed resource.

ip_version float
ipv6_address_mode str
ipv6_ra_mode str
name str
network_id str
region str

See Argument Reference above.

subnet_id str
subnetpool_id str
tenant_id str
dhcp_disabled bool
dhcp_enabled bool
tags List[str]

Supporting Types

GetSubnetAllocationPool

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

End string
Start string
End string
Start string
end string
start string
end str
start str

GetSubnetHostRoute

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

DestinationCidr string
NextHop string
DestinationCidr string
NextHop string
destinationCidr string
nextHop string
destination_cidr str
next_hop str

Package Details

Repository
https://github.com/pulumi/pulumi-openstack
License
Apache-2.0
Notes
This Pulumi package is based on the openstack Terraform Provider.