OpenStack v5.0.0 published on Friday, Sep 27, 2024 by Pulumi
openstack.networking.getSubnet
Explore with Pulumi AI
Use this data source to get the ID of an available OpenStack subnet.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const subnet1 = openstack.networking.getSubnet({
name: "subnet_1",
});
import pulumi
import pulumi_openstack as openstack
subnet1 = openstack.networking.get_subnet(name="subnet_1")
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.LookupSubnet(ctx, &networking.LookupSubnetArgs{
Name: pulumi.StringRef("subnet_1"),
}, 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 subnet1 = OpenStack.Networking.GetSubnet.Invoke(new()
{
Name = "subnet_1",
});
});
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.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 subnet1 = NetworkingFunctions.getSubnet(GetSubnetArgs.builder()
.name("subnet_1")
.build());
}
}
variables:
subnet1:
fn::invoke:
Function: openstack:networking:getSubnet
Arguments:
name: subnet_1
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(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,
network_id: Optional[str] = None,
region: Optional[str] = None,
subnet_id: Optional[str] = None,
subnetpool_id: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
tenant_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSubnetResult
def get_subnet_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,
network_id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
subnet_id: 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[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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: openstack:networking/getSubnet:getSubnet
arguments:
# arguments dictionary
The 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.
- 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
region
argument of the provider is used. - Subnet
Id string - The ID of the subnet.
- 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.
- 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
region
argument of the provider is used. - Subnet
Id string - The ID of the subnet.
- 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.
- 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
region
argument of the provider is used. - subnet
Id String - The ID of the subnet.
- 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.
- 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
region
argument of the provider is used. - subnet
Id string - The ID of the subnet.
- 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.
- 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.
- 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.
- 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
region
argument of the provider is used. - subnet
Id String - The ID of the subnet.
- 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.
getSubnet Result
The following output properties are available:
- List<string>
- A set of string tags applied on the subnet.
- Allocation
Pools List<Pulumi.Open Stack. Networking. Outputs. Get Subnet Allocation Pool> - Allocation pools of the subnet.
- Cidr string
- Description string
- Dns
Nameservers List<string> - DNS Nameservers of the subnet.
- Enable
Dhcp bool - Whether the subnet has DHCP enabled or not.
- Gateway
Ip string - Host
Routes List<Pulumi.Open Stack. Networking. Outputs. Get Subnet Host Route> - Host Routes of the subnet.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ip
Version int - Ipv6Address
Mode string - Ipv6Ra
Mode string - Name string
- Network
Id string - Region string
- See Argument Reference above.
- Service
Types List<string> - Service types of the subnet.
- Subnet
Id string - Subnetpool
Id string - Tenant
Id string - Dhcp
Enabled bool - Dns
Publish boolFixed Ip - List<string>
- []string
- A set of string tags applied on the subnet.
- Allocation
Pools []GetSubnet Allocation Pool - Allocation pools of the subnet.
- Cidr string
- Description string
- Dns
Nameservers []string - DNS Nameservers of the subnet.
- Enable
Dhcp bool - Whether the subnet has DHCP enabled or not.
- Gateway
Ip string - Host
Routes []GetSubnet Host Route - Host Routes of the subnet.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ip
Version int - Ipv6Address
Mode string - Ipv6Ra
Mode string - Name string
- Network
Id string - Region string
- See Argument Reference above.
- Service
Types []string - Service types of the subnet.
- Subnet
Id string - Subnetpool
Id string - Tenant
Id string - Dhcp
Enabled bool - Dns
Publish boolFixed Ip - []string
- List<String>
- A set of string tags applied on the subnet.
- allocation
Pools List<GetSubnet Allocation Pool> - Allocation pools of the subnet.
- cidr String
- description String
- dns
Nameservers List<String> - DNS Nameservers of the subnet.
- enable
Dhcp Boolean - Whether the subnet has DHCP enabled or not.
- gateway
Ip String - host
Routes List<GetSubnet Host Route> - Host Routes of the subnet.
- id String
- The provider-assigned unique ID for this managed resource.
- ip
Version Integer - ipv6Address
Mode String - ipv6Ra
Mode String - name String
- network
Id String - region String
- See Argument Reference above.
- service
Types List<String> - Service types of the subnet.
- subnet
Id String - subnetpool
Id String - tenant
Id String - dhcp
Enabled Boolean - dns
Publish BooleanFixed Ip - List<String>
- string[]
- A set of string tags applied on the subnet.
- allocation
Pools GetSubnet Allocation Pool[] - Allocation pools of the subnet.
- cidr string
- description string
- dns
Nameservers string[] - DNS Nameservers of the subnet.
- enable
Dhcp boolean - Whether the subnet has DHCP enabled or not.
- gateway
Ip string - host
Routes GetSubnet Host Route[] - Host Routes of the subnet.
- id string
- The provider-assigned unique ID for this managed resource.
- ip
Version number - ipv6Address
Mode string - ipv6Ra
Mode string - name string
- network
Id string - region string
- See Argument Reference above.
- service
Types string[] - Service types of the subnet.
- subnet
Id string - subnetpool
Id string - tenant
Id string - dhcp
Enabled boolean - dns
Publish booleanFixed Ip - string[]
- Sequence[str]
- A set of string tags applied on the subnet.
- allocation_
pools Sequence[GetSubnet Allocation Pool] - Allocation pools of the subnet.
- cidr str
- description str
- dns_
nameservers Sequence[str] - DNS Nameservers of the subnet.
- enable_
dhcp bool - Whether the subnet has DHCP enabled or not.
- gateway_
ip str - host_
routes Sequence[GetSubnet Host Route] - Host Routes of the subnet.
- id str
- The provider-assigned unique ID for this managed resource.
- ip_
version int - ipv6_
address_ strmode - ipv6_
ra_ strmode - name str
- network_
id str - region str
- See Argument Reference above.
- service_
types Sequence[str] - Service types of the subnet.
- subnet_
id str - subnetpool_
id str - tenant_
id str - dhcp_
enabled bool - dns_
publish_ boolfixed_ ip - Sequence[str]
- List<String>
- A set of string tags applied on the subnet.
- allocation
Pools List<Property Map> - Allocation pools of the subnet.
- cidr String
- description String
- dns
Nameservers List<String> - DNS Nameservers of the subnet.
- enable
Dhcp Boolean - Whether the subnet has DHCP enabled or not.
- gateway
Ip String - host
Routes List<Property Map> - Host Routes of the subnet.
- id String
- The provider-assigned unique ID for this managed resource.
- ip
Version Number - ipv6Address
Mode String - ipv6Ra
Mode String - name String
- network
Id String - region String
- See Argument Reference above.
- service
Types List<String> - Service types of the subnet.
- subnet
Id String - subnetpool
Id String - tenant
Id String - dhcp
Enabled Boolean - dns
Publish BooleanFixed Ip - List<String>
Supporting Types
GetSubnetAllocationPool
GetSubnetHostRoute
- Destination
Cidr string - Next
Hop string
- Destination
Cidr string - Next
Hop string
- destination
Cidr String - next
Hop String
- destination
Cidr string - next
Hop string
- destination_
cidr str - next_
hop str
- destination
Cidr String - next
Hop String
Package Details
- Repository
- OpenStack pulumi/pulumi-openstack
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
openstack
Terraform Provider.