openstack logo
OpenStack v3.12.1, Mar 23 23

openstack.networking.Subnet

Manages a V2 Neutron subnet resource within OpenStack.

Example Usage

using System.Collections.Generic;
using Pulumi;
using OpenStack = Pulumi.OpenStack;

return await Deployment.RunAsync(() => 
{
    var network1 = new OpenStack.Networking.Network("network1", new()
    {
        AdminStateUp = true,
    });

    var subnet1 = new OpenStack.Networking.Subnet("subnet1", new()
    {
        Cidr = "192.168.199.0/24",
        NetworkId = network1.Id,
    });

});
package main

import (
	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/networking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		network1, err := networking.NewNetwork(ctx, "network1", &networking.NetworkArgs{
			AdminStateUp: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = networking.NewSubnet(ctx, "subnet1", &networking.SubnetArgs{
			Cidr:      pulumi.String("192.168.199.0/24"),
			NetworkId: network1.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.Network;
import com.pulumi.openstack.networking.NetworkArgs;
import com.pulumi.openstack.networking.Subnet;
import com.pulumi.openstack.networking.SubnetArgs;
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) {
        var network1 = new Network("network1", NetworkArgs.builder()        
            .adminStateUp("true")
            .build());

        var subnet1 = new Subnet("subnet1", SubnetArgs.builder()        
            .cidr("192.168.199.0/24")
            .networkId(network1.id())
            .build());

    }
}
import pulumi
import pulumi_openstack as openstack

network1 = openstack.networking.Network("network1", admin_state_up=True)
subnet1 = openstack.networking.Subnet("subnet1",
    cidr="192.168.199.0/24",
    network_id=network1.id)
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const network1 = new openstack.networking.Network("network1", {adminStateUp: true});
const subnet1 = new openstack.networking.Subnet("subnet1", {
    cidr: "192.168.199.0/24",
    networkId: network1.id,
});
resources:
  network1:
    type: openstack:networking:Network
    properties:
      adminStateUp: 'true'
  subnet1:
    type: openstack:networking:Subnet
    properties:
      cidr: 192.168.199.0/24
      networkId: ${network1.id}

Create Subnet Resource

new Subnet(name: string, args: SubnetArgs, opts?: CustomResourceOptions);
@overload
def Subnet(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           allocation_pools: Optional[Sequence[SubnetAllocationPoolArgs]] = None,
           allocation_pools_collection: Optional[Sequence[SubnetAllocationPoolsCollectionArgs]] = None,
           cidr: Optional[str] = None,
           description: Optional[str] = None,
           dns_nameservers: Optional[Sequence[str]] = None,
           enable_dhcp: Optional[bool] = None,
           gateway_ip: Optional[str] = None,
           host_routes: Optional[Sequence[SubnetHostRouteArgs]] = 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,
           no_gateway: Optional[bool] = None,
           prefix_length: Optional[int] = None,
           region: Optional[str] = None,
           service_types: Optional[Sequence[str]] = None,
           subnetpool_id: Optional[str] = None,
           tags: Optional[Sequence[str]] = None,
           tenant_id: Optional[str] = None,
           value_specs: Optional[Mapping[str, Any]] = None)
@overload
def Subnet(resource_name: str,
           args: SubnetArgs,
           opts: Optional[ResourceOptions] = None)
func NewSubnet(ctx *Context, name string, args SubnetArgs, opts ...ResourceOption) (*Subnet, error)
public Subnet(string name, SubnetArgs args, CustomResourceOptions? opts = null)
public Subnet(String name, SubnetArgs args)
public Subnet(String name, SubnetArgs args, CustomResourceOptions options)
type: openstack:networking:Subnet
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args SubnetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args SubnetArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args SubnetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SubnetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args SubnetArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Subnet Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Subnet resource accepts the following input properties:

NetworkId string

The UUID of the parent network. Changing this creates a new subnet.

AllocationPools List<Pulumi.OpenStack.Networking.Inputs.SubnetAllocationPoolArgs>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

AllocationPoolsCollection List<Pulumi.OpenStack.Networking.Inputs.SubnetAllocationPoolsCollectionArgs>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

Cidr string

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

Description string

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

DnsNameservers List<string>

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

EnableDhcp bool

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

GatewayIp string

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

HostRoutes List<Pulumi.OpenStack.Networking.Inputs.SubnetHostRouteArgs>

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

IpVersion int

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

NoGateway bool

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

PrefixLength int

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

Region string

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

ServiceTypes List<string>

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

SubnetpoolId string

The ID of the subnetpool associated with the subnet.

Tags List<string>

A set of string tags for the subnet.

TenantId string

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

ValueSpecs Dictionary<string, object>

Map of additional options.

NetworkId string

The UUID of the parent network. Changing this creates a new subnet.

AllocationPools []SubnetAllocationPoolArgs

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

AllocationPoolsCollection []SubnetAllocationPoolsCollectionArgs

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

Cidr string

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

Description string

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

DnsNameservers []string

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

EnableDhcp bool

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

GatewayIp string

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

HostRoutes []SubnetHostRouteArgs

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

IpVersion int

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

NoGateway bool

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

PrefixLength int

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

Region string

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

ServiceTypes []string

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

SubnetpoolId string

The ID of the subnetpool associated with the subnet.

Tags []string

A set of string tags for the subnet.

TenantId string

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

ValueSpecs map[string]interface{}

Map of additional options.

networkId String

The UUID of the parent network. Changing this creates a new subnet.

allocationPools List<SubnetAllocationPoolArgs>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

allocationPoolsCollection List<SubnetAllocationPoolsCollectionArgs>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

cidr String

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

description String

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

dnsNameservers List<String>

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

enableDhcp Boolean

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

gatewayIp String

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

hostRoutes List<SubnetHostRouteArgs>

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

ipVersion Integer

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

noGateway Boolean

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

prefixLength Integer

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

region String

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

serviceTypes List<String>

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

subnetpoolId String

The ID of the subnetpool associated with the subnet.

tags List<String>

A set of string tags for the subnet.

tenantId String

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

valueSpecs Map<String,Object>

Map of additional options.

networkId string

The UUID of the parent network. Changing this creates a new subnet.

allocationPools SubnetAllocationPoolArgs[]

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

allocationPoolsCollection SubnetAllocationPoolsCollectionArgs[]

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

cidr string

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

description string

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

dnsNameservers string[]

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

enableDhcp boolean

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

gatewayIp string

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

hostRoutes SubnetHostRouteArgs[]

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

ipVersion number

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

noGateway boolean

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

prefixLength number

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

region string

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

serviceTypes string[]

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

subnetpoolId string

The ID of the subnetpool associated with the subnet.

tags string[]

A set of string tags for the subnet.

tenantId string

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

valueSpecs {[key: string]: any}

Map of additional options.

network_id str

The UUID of the parent network. Changing this creates a new subnet.

allocation_pools Sequence[SubnetAllocationPoolArgs]

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

allocation_pools_collection Sequence[SubnetAllocationPoolsCollectionArgs]

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

cidr str

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

description str

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

dns_nameservers Sequence[str]

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

enable_dhcp bool

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

gateway_ip str

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

host_routes Sequence[SubnetHostRouteArgs]

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

ip_version int

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

no_gateway bool

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

prefix_length int

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

region str

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

service_types Sequence[str]

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

subnetpool_id str

The ID of the subnetpool associated with the subnet.

tags Sequence[str]

A set of string tags for the subnet.

tenant_id str

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

value_specs Mapping[str, Any]

Map of additional options.

networkId String

The UUID of the parent network. Changing this creates a new subnet.

allocationPools List<Property Map>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

allocationPoolsCollection List<Property Map>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

cidr String

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

description String

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

dnsNameservers List<String>

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

enableDhcp Boolean

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

gatewayIp String

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

hostRoutes List<Property Map>

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

ipVersion Number

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

noGateway Boolean

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

prefixLength Number

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

region String

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

serviceTypes List<String>

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

subnetpoolId String

The ID of the subnetpool associated with the subnet.

tags List<String>

A set of string tags for the subnet.

tenantId String

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

valueSpecs Map<Any>

Map of additional options.

Outputs

All input properties are implicitly available as output properties. Additionally, the Subnet resource produces the following output properties:

AllTags List<string>

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

Id string

The provider-assigned unique ID for this managed resource.

AllTags []string

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

Id string

The provider-assigned unique ID for this managed resource.

allTags List<String>

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

id String

The provider-assigned unique ID for this managed resource.

allTags string[]

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

id string

The provider-assigned unique ID for this managed resource.

all_tags Sequence[str]

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

id str

The provider-assigned unique ID for this managed resource.

allTags List<String>

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Subnet Resource

Get an existing Subnet resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SubnetState, opts?: CustomResourceOptions): Subnet
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        all_tags: Optional[Sequence[str]] = None,
        allocation_pools: Optional[Sequence[SubnetAllocationPoolArgs]] = None,
        allocation_pools_collection: Optional[Sequence[SubnetAllocationPoolsCollectionArgs]] = None,
        cidr: Optional[str] = None,
        description: Optional[str] = None,
        dns_nameservers: Optional[Sequence[str]] = None,
        enable_dhcp: Optional[bool] = None,
        gateway_ip: Optional[str] = None,
        host_routes: Optional[Sequence[SubnetHostRouteArgs]] = 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,
        no_gateway: Optional[bool] = None,
        prefix_length: Optional[int] = None,
        region: Optional[str] = None,
        service_types: Optional[Sequence[str]] = None,
        subnetpool_id: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        tenant_id: Optional[str] = None,
        value_specs: Optional[Mapping[str, Any]] = None) -> Subnet
func GetSubnet(ctx *Context, name string, id IDInput, state *SubnetState, opts ...ResourceOption) (*Subnet, error)
public static Subnet Get(string name, Input<string> id, SubnetState? state, CustomResourceOptions? opts = null)
public static Subnet get(String name, Output<String> id, SubnetState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AllTags List<string>

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

AllocationPools List<Pulumi.OpenStack.Networking.Inputs.SubnetAllocationPoolArgs>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

AllocationPoolsCollection List<Pulumi.OpenStack.Networking.Inputs.SubnetAllocationPoolsCollectionArgs>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

Cidr string

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

Description string

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

DnsNameservers List<string>

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

EnableDhcp bool

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

GatewayIp string

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

HostRoutes List<Pulumi.OpenStack.Networking.Inputs.SubnetHostRouteArgs>

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

IpVersion int

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

NetworkId string

The UUID of the parent network. Changing this creates a new subnet.

NoGateway bool

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

PrefixLength int

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

Region string

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

ServiceTypes List<string>

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

SubnetpoolId string

The ID of the subnetpool associated with the subnet.

Tags List<string>

A set of string tags for the subnet.

TenantId string

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

ValueSpecs Dictionary<string, object>

Map of additional options.

AllTags []string

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

AllocationPools []SubnetAllocationPoolArgs

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

AllocationPoolsCollection []SubnetAllocationPoolsCollectionArgs

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

Cidr string

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

Description string

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

DnsNameservers []string

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

EnableDhcp bool

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

GatewayIp string

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

HostRoutes []SubnetHostRouteArgs

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

IpVersion int

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

NetworkId string

The UUID of the parent network. Changing this creates a new subnet.

NoGateway bool

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

PrefixLength int

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

Region string

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

ServiceTypes []string

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

SubnetpoolId string

The ID of the subnetpool associated with the subnet.

Tags []string

A set of string tags for the subnet.

TenantId string

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

ValueSpecs map[string]interface{}

Map of additional options.

allTags List<String>

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

allocationPools List<SubnetAllocationPoolArgs>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

allocationPoolsCollection List<SubnetAllocationPoolsCollectionArgs>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

cidr String

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

description String

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

dnsNameservers List<String>

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

enableDhcp Boolean

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

gatewayIp String

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

hostRoutes List<SubnetHostRouteArgs>

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

ipVersion Integer

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

networkId String

The UUID of the parent network. Changing this creates a new subnet.

noGateway Boolean

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

prefixLength Integer

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

region String

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

serviceTypes List<String>

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

subnetpoolId String

The ID of the subnetpool associated with the subnet.

tags List<String>

A set of string tags for the subnet.

tenantId String

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

valueSpecs Map<String,Object>

Map of additional options.

allTags string[]

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

allocationPools SubnetAllocationPoolArgs[]

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

allocationPoolsCollection SubnetAllocationPoolsCollectionArgs[]

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

cidr string

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

description string

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

dnsNameservers string[]

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

enableDhcp boolean

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

gatewayIp string

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

hostRoutes SubnetHostRouteArgs[]

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

ipVersion number

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

networkId string

The UUID of the parent network. Changing this creates a new subnet.

noGateway boolean

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

prefixLength number

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

region string

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

serviceTypes string[]

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

subnetpoolId string

The ID of the subnetpool associated with the subnet.

tags string[]

A set of string tags for the subnet.

tenantId string

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

valueSpecs {[key: string]: any}

Map of additional options.

all_tags Sequence[str]

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

allocation_pools Sequence[SubnetAllocationPoolArgs]

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

allocation_pools_collection Sequence[SubnetAllocationPoolsCollectionArgs]

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

cidr str

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

description str

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

dns_nameservers Sequence[str]

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

enable_dhcp bool

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

gateway_ip str

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

host_routes Sequence[SubnetHostRouteArgs]

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

ip_version int

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

network_id str

The UUID of the parent network. Changing this creates a new subnet.

no_gateway bool

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

prefix_length int

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

region str

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

service_types Sequence[str]

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

subnetpool_id str

The ID of the subnetpool associated with the subnet.

tags Sequence[str]

A set of string tags for the subnet.

tenant_id str

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

value_specs Mapping[str, Any]

Map of additional options.

allTags List<String>

The collection of ags assigned on the subnet, which have been explicitly and implicitly added.

allocationPools List<Property Map>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. Multiple allocation_pool blocks can be declared, providing the subnet with more than one range of IP addresses to use with DHCP. However, each IP range must be from the same CIDR that the subnet is part of. The allocation_pool block is documented below.

allocationPoolsCollection List<Property Map>

A block declaring the start and end range of the IP addresses available for use with DHCP in this subnet. The allocation_pools block is documented below.

Deprecated:

use allocation_pool instead

cidr String

CIDR representing IP range for this subnet, based on IP version. You can omit this option if you are creating a subnet from a subnet pool.

description String

Human-readable description of the subnet. Changing this updates the name of the existing subnet.

dnsNameservers List<String>

An array of DNS name server names used by hosts in this subnet. Changing this updates the DNS name servers for the existing subnet.

enableDhcp Boolean

The administrative state of the network. Acceptable values are "true" and "false". Changing this value enables or disables the DHCP capabilities of the existing subnet. Defaults to true.

gatewayIp String

Default gateway used by devices in this subnet. Leaving this blank and not setting no_gateway will cause a default gateway of .1 to be used. Changing this updates the gateway IP of the existing subnet.

hostRoutes List<Property Map>

(Deprecated - use openstack.networking.SubnetRoute instead) An array of routes that should be used by devices with IPs from this subnet (not including local subnet route). The host_route object structure is documented below. Changing this updates the host routes for the existing subnet.

Deprecated:

Use openstack_networking_subnet_route_v2 instead

ipVersion Number

IP version, either 4 (default) or 6. Changing this creates a new subnet.

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. Changing this updates the name of the existing subnet.

networkId String

The UUID of the parent network. Changing this creates a new subnet.

noGateway Boolean

Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.

prefixLength Number

The prefix length to use when creating a subnet from a subnet pool. The default subnet pool prefix length that was defined when creating the subnet pool will be used if not provided. Changing this creates a new subnet.

region String

The region in which to obtain the V2 Networking client. A Networking client is needed to create a Neutron subnet. If omitted, the region argument of the provider is used. Changing this creates a new subnet.

serviceTypes List<String>

An array of service types used by the subnet. Changing this updates the service types for the existing subnet.

subnetpoolId String

The ID of the subnetpool associated with the subnet.

tags List<String>

A set of string tags for the subnet.

tenantId String

The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.

valueSpecs Map<Any>

Map of additional options.

Supporting Types

SubnetAllocationPool

End string

The ending address.

Start string

The starting address.

End string

The ending address.

Start string

The starting address.

end String

The ending address.

start String

The starting address.

end string

The ending address.

start string

The starting address.

end str

The ending address.

start str

The starting address.

end String

The ending address.

start String

The starting address.

SubnetAllocationPoolsCollection

End string

The ending address.

Start string

The starting address.

End string

The ending address.

Start string

The starting address.

end String

The ending address.

start String

The starting address.

end string

The ending address.

start string

The starting address.

end str

The ending address.

start str

The starting address.

end String

The ending address.

start String

The starting address.

SubnetHostRoute

DestinationCidr string

The destination CIDR.

NextHop string

The next hop in the route.

DestinationCidr string

The destination CIDR.

NextHop string

The next hop in the route.

destinationCidr String

The destination CIDR.

nextHop String

The next hop in the route.

destinationCidr string

The destination CIDR.

nextHop string

The next hop in the route.

destination_cidr str

The destination CIDR.

next_hop str

The next hop in the route.

destinationCidr String

The destination CIDR.

nextHop String

The next hop in the route.

Import

Subnets can be imported using the id, e.g.

 $ pulumi import openstack:networking/subnet:Subnet subnet_1 da4faf16-5546-41e4-8330-4d0002b74048

Package Details

Repository
OpenStack pulumi/pulumi-openstack
License
Apache-2.0
Notes

This Pulumi package is based on the openstack Terraform Provider.