1. Packages
  2. Openstack Provider
  3. API Docs
  4. networking
  5. Subnet
OpenStack v4.1.3 published on Wednesday, Aug 21, 2024 by Pulumi

openstack.networking.Subnet

Explore with Pulumi AI

openstack logo
OpenStack v4.1.3 published on Wednesday, Aug 21, 2024 by Pulumi

    Manages a V2 Neutron subnet resource within OpenStack.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const network1 = new openstack.networking.Network("network_1", {
        name: "tf_test_network",
        adminStateUp: true,
    });
    const subnet1 = new openstack.networking.Subnet("subnet_1", {
        networkId: network1.id,
        cidr: "192.168.199.0/24",
    });
    
    import pulumi
    import pulumi_openstack as openstack
    
    network1 = openstack.networking.Network("network_1",
        name="tf_test_network",
        admin_state_up=True)
    subnet1 = openstack.networking.Subnet("subnet_1",
        network_id=network1.id,
        cidr="192.168.199.0/24")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-openstack/sdk/v4/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, "network_1", &networking.NetworkArgs{
    			Name:         pulumi.String("tf_test_network"),
    			AdminStateUp: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = networking.NewSubnet(ctx, "subnet_1", &networking.SubnetArgs{
    			NetworkId: network1.ID(),
    			Cidr:      pulumi.String("192.168.199.0/24"),
    		})
    		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 network1 = new OpenStack.Networking.Network("network_1", new()
        {
            Name = "tf_test_network",
            AdminStateUp = true,
        });
    
        var subnet1 = new OpenStack.Networking.Subnet("subnet_1", new()
        {
            NetworkId = network1.Id,
            Cidr = "192.168.199.0/24",
        });
    
    });
    
    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()
                .name("tf_test_network")
                .adminStateUp("true")
                .build());
    
            var subnet1 = new Subnet("subnet1", SubnetArgs.builder()
                .networkId(network1.id())
                .cidr("192.168.199.0/24")
                .build());
    
        }
    }
    
    resources:
      network1:
        type: openstack:networking:Network
        name: network_1
        properties:
          name: tf_test_network
          adminStateUp: 'true'
      subnet1:
        type: openstack:networking:Subnet
        name: subnet_1
        properties:
          networkId: ${network1.id}
          cidr: 192.168.199.0/24
    

    Create Subnet Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Subnet(name: string, args: SubnetArgs, opts?: CustomResourceOptions);
    @overload
    def Subnet(resource_name: str,
               args: SubnetArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Subnet(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               network_id: Optional[str] = None,
               name: Optional[str] = None,
               value_specs: Optional[Mapping[str, str]] = None,
               ipv6_ra_mode: Optional[str] = None,
               dns_publish_fixed_ip: Optional[bool] = None,
               enable_dhcp: Optional[bool] = None,
               gateway_ip: Optional[str] = None,
               ip_version: Optional[int] = None,
               ipv6_address_mode: Optional[str] = None,
               dns_nameservers: Optional[Sequence[str]] = None,
               description: Optional[str] = None,
               no_gateway: Optional[bool] = None,
               cidr: Optional[str] = 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,
               allocation_pools: Optional[Sequence[SubnetAllocationPoolArgs]] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var subnetResource = new OpenStack.Networking.Subnet("subnetResource", new()
    {
        NetworkId = "string",
        Name = "string",
        ValueSpecs = 
        {
            { "string", "string" },
        },
        Ipv6RaMode = "string",
        DnsPublishFixedIp = false,
        EnableDhcp = false,
        GatewayIp = "string",
        IpVersion = 0,
        Ipv6AddressMode = "string",
        DnsNameservers = new[]
        {
            "string",
        },
        Description = "string",
        NoGateway = false,
        Cidr = "string",
        PrefixLength = 0,
        Region = "string",
        ServiceTypes = new[]
        {
            "string",
        },
        SubnetpoolId = "string",
        Tags = new[]
        {
            "string",
        },
        TenantId = "string",
        AllocationPools = new[]
        {
            new OpenStack.Networking.Inputs.SubnetAllocationPoolArgs
            {
                End = "string",
                Start = "string",
            },
        },
    });
    
    example, err := networking.NewSubnet(ctx, "subnetResource", &networking.SubnetArgs{
    	NetworkId: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    	ValueSpecs: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Ipv6RaMode:        pulumi.String("string"),
    	DnsPublishFixedIp: pulumi.Bool(false),
    	EnableDhcp:        pulumi.Bool(false),
    	GatewayIp:         pulumi.String("string"),
    	IpVersion:         pulumi.Int(0),
    	Ipv6AddressMode:   pulumi.String("string"),
    	DnsNameservers: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Description:  pulumi.String("string"),
    	NoGateway:    pulumi.Bool(false),
    	Cidr:         pulumi.String("string"),
    	PrefixLength: pulumi.Int(0),
    	Region:       pulumi.String("string"),
    	ServiceTypes: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	SubnetpoolId: pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	TenantId: pulumi.String("string"),
    	AllocationPools: networking.SubnetAllocationPoolArray{
    		&networking.SubnetAllocationPoolArgs{
    			End:   pulumi.String("string"),
    			Start: pulumi.String("string"),
    		},
    	},
    })
    
    var subnetResource = new Subnet("subnetResource", SubnetArgs.builder()
        .networkId("string")
        .name("string")
        .valueSpecs(Map.of("string", "string"))
        .ipv6RaMode("string")
        .dnsPublishFixedIp(false)
        .enableDhcp(false)
        .gatewayIp("string")
        .ipVersion(0)
        .ipv6AddressMode("string")
        .dnsNameservers("string")
        .description("string")
        .noGateway(false)
        .cidr("string")
        .prefixLength(0)
        .region("string")
        .serviceTypes("string")
        .subnetpoolId("string")
        .tags("string")
        .tenantId("string")
        .allocationPools(SubnetAllocationPoolArgs.builder()
            .end("string")
            .start("string")
            .build())
        .build());
    
    subnet_resource = openstack.networking.Subnet("subnetResource",
        network_id="string",
        name="string",
        value_specs={
            "string": "string",
        },
        ipv6_ra_mode="string",
        dns_publish_fixed_ip=False,
        enable_dhcp=False,
        gateway_ip="string",
        ip_version=0,
        ipv6_address_mode="string",
        dns_nameservers=["string"],
        description="string",
        no_gateway=False,
        cidr="string",
        prefix_length=0,
        region="string",
        service_types=["string"],
        subnetpool_id="string",
        tags=["string"],
        tenant_id="string",
        allocation_pools=[openstack.networking.SubnetAllocationPoolArgs(
            end="string",
            start="string",
        )])
    
    const subnetResource = new openstack.networking.Subnet("subnetResource", {
        networkId: "string",
        name: "string",
        valueSpecs: {
            string: "string",
        },
        ipv6RaMode: "string",
        dnsPublishFixedIp: false,
        enableDhcp: false,
        gatewayIp: "string",
        ipVersion: 0,
        ipv6AddressMode: "string",
        dnsNameservers: ["string"],
        description: "string",
        noGateway: false,
        cidr: "string",
        prefixLength: 0,
        region: "string",
        serviceTypes: ["string"],
        subnetpoolId: "string",
        tags: ["string"],
        tenantId: "string",
        allocationPools: [{
            end: "string",
            start: "string",
        }],
    });
    
    type: openstack:networking:Subnet
    properties:
        allocationPools:
            - end: string
              start: string
        cidr: string
        description: string
        dnsNameservers:
            - string
        dnsPublishFixedIp: false
        enableDhcp: false
        gatewayIp: string
        ipVersion: 0
        ipv6AddressMode: string
        ipv6RaMode: string
        name: string
        networkId: string
        noGateway: false
        prefixLength: 0
        region: string
        serviceTypes:
            - string
        subnetpoolId: string
        tags:
            - string
        tenantId: string
        valueSpecs:
            string: string
    

    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.SubnetAllocationPool>
    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.
    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.
    DnsPublishFixedIp bool
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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, string>
    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.
    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.
    DnsPublishFixedIp bool
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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]string
    Map of additional options.
    networkId String
    The UUID of the parent network. Changing this creates a new subnet.
    allocationPools List<SubnetAllocationPool>
    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.
    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.
    dnsPublishFixedIp Boolean
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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,String>
    Map of additional options.
    networkId string
    The UUID of the parent network. Changing this creates a new subnet.
    allocationPools SubnetAllocationPool[]
    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.
    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.
    dnsPublishFixedIp boolean
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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]: string}
    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.
    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.
    dns_publish_fixed_ip bool
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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, str]
    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.
    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.
    dnsPublishFixedIp Boolean
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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<String>
    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,
            cidr: Optional[str] = None,
            description: Optional[str] = None,
            dns_nameservers: Optional[Sequence[str]] = None,
            dns_publish_fixed_ip: Optional[bool] = None,
            enable_dhcp: 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,
            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, str]] = 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.SubnetAllocationPool>
    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.
    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.
    DnsPublishFixedIp bool
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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, string>
    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.
    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.
    DnsPublishFixedIp bool
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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]string
    Map of additional options.
    allTags List<String>
    The collection of ags assigned on the subnet, which have been explicitly and implicitly added.
    allocationPools List<SubnetAllocationPool>
    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.
    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.
    dnsPublishFixedIp Boolean
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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,String>
    Map of additional options.
    allTags string[]
    The collection of ags assigned on the subnet, which have been explicitly and implicitly added.
    allocationPools SubnetAllocationPool[]
    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.
    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.
    dnsPublishFixedIp boolean
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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]: string}
    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.
    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.
    dns_publish_fixed_ip bool
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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, str]
    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.
    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.
    dnsPublishFixedIp Boolean
    Whether to publish DNS records for IPs from this subnet. Defaults is false.
    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.
    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<String>
    Map of additional options.

    Supporting Types

    SubnetAllocationPool, SubnetAllocationPoolArgs

    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.

    Import

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

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

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    OpenStack pulumi/pulumi-openstack
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the openstack Terraform Provider.
    openstack logo
    OpenStack v4.1.3 published on Wednesday, Aug 21, 2024 by Pulumi