openstack.networking.Subnet
Explore with Pulumi AI
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/v5/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=[{
"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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Subnet resource accepts the following input properties:
- Network
Id string - The UUID of the parent network. Changing this creates a new subnet.
- Allocation
Pools List<Pulumi.Open Stack. Networking. Inputs. Subnet Allocation Pool> - 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. Theallocation_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.
- Dns
Nameservers 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.
- Dns
Publish boolFixed Ip - 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 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. - Ip
Version int - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- Ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - Ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - Name string
- The name of the subnet. 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 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. - Service
Types List<string> - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- Subnetpool
Id string - The ID of the subnetpool associated with the subnet.
- List<string>
- A set of string tags for the subnet.
- Tenant
Id string - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- Value
Specs Dictionary<string, string> - Map of additional options.
- Network
Id string - The UUID of the parent network. Changing this creates a new subnet.
- Allocation
Pools []SubnetAllocation Pool Args - 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. Theallocation_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.
- Dns
Nameservers []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.
- Dns
Publish boolFixed Ip - 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 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. - Ip
Version int - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- Ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - Ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - Name string
- The name of the subnet. 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 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. - Service
Types []string - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- Subnetpool
Id string - The ID of the subnetpool associated with the subnet.
- []string
- A set of string tags for the subnet.
- Tenant
Id string - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- Value
Specs map[string]string - Map of additional options.
- network
Id String - The UUID of the parent network. Changing this creates a new subnet.
- allocation
Pools List<SubnetAllocation Pool> - 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. Theallocation_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.
- dns
Nameservers 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.
- dns
Publish BooleanFixed Ip - Whether to publish DNS records for IPs from this subnet. Defaults is false.
- enable
Dhcp 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.
- gateway
Ip 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. - ip
Version Integer - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- ipv6Address
Mode String - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - ipv6Ra
Mode String - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - name String
- The name of the subnet. Changing this updates the name of the existing subnet.
- no
Gateway Boolean - Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.
- prefix
Length 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. - service
Types List<String> - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- subnetpool
Id String - The ID of the subnetpool associated with the subnet.
- List<String>
- A set of string tags for the subnet.
- tenant
Id String - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- value
Specs Map<String,String> - Map of additional options.
- network
Id string - The UUID of the parent network. Changing this creates a new subnet.
- allocation
Pools SubnetAllocation Pool[] - 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. Theallocation_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.
- dns
Nameservers 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.
- dns
Publish booleanFixed Ip - Whether to publish DNS records for IPs from this subnet. Defaults is false.
- enable
Dhcp 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.
- gateway
Ip 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. - ip
Version number - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - name string
- The name of the subnet. Changing this updates the name of the existing subnet.
- no
Gateway boolean - Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.
- prefix
Length 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. - service
Types string[] - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- subnetpool
Id string - The ID of the subnetpool associated with the subnet.
- string[]
- A set of string tags for the subnet.
- tenant
Id string - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- value
Specs {[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[SubnetAllocation Pool Args] - 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. Theallocation_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_ boolfixed_ ip - 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_ strmode - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - ipv6_
ra_ strmode - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - name str
- The name of the subnet. 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.
- 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.
- network
Id String - The UUID of the parent network. Changing this creates a new subnet.
- allocation
Pools 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. Theallocation_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.
- dns
Nameservers 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.
- dns
Publish BooleanFixed Ip - Whether to publish DNS records for IPs from this subnet. Defaults is false.
- enable
Dhcp 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.
- gateway
Ip 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. - ip
Version Number - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- ipv6Address
Mode String - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - ipv6Ra
Mode String - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - name String
- The name of the subnet. Changing this updates the name of the existing subnet.
- no
Gateway Boolean - Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.
- prefix
Length 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. - service
Types List<String> - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- subnetpool
Id String - The ID of the subnetpool associated with the subnet.
- List<String>
- A set of string tags for the subnet.
- tenant
Id String - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- value
Specs 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:
- 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.
- []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.
- 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.
- 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.
- 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.
- 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.
- List<string>
- The collection of ags assigned on the subnet, which have been explicitly and implicitly added.
- Allocation
Pools List<Pulumi.Open Stack. Networking. Inputs. Subnet Allocation Pool> - 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. Theallocation_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.
- Dns
Nameservers 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.
- Dns
Publish boolFixed Ip - 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 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. - Ip
Version int - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- Ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - Ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - Name string
- The name of the subnet. Changing this updates the name of the existing subnet.
- Network
Id string - 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 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. - Service
Types List<string> - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- Subnetpool
Id string - The ID of the subnetpool associated with the subnet.
- List<string>
- A set of string tags for the subnet.
- Tenant
Id string - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- Value
Specs Dictionary<string, string> - Map of additional options.
- []string
- The collection of ags assigned on the subnet, which have been explicitly and implicitly added.
- Allocation
Pools []SubnetAllocation Pool Args - 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. Theallocation_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.
- Dns
Nameservers []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.
- Dns
Publish boolFixed Ip - 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 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. - Ip
Version int - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- Ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - Ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - Name string
- The name of the subnet. Changing this updates the name of the existing subnet.
- Network
Id string - 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 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. - Service
Types []string - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- Subnetpool
Id string - The ID of the subnetpool associated with the subnet.
- []string
- A set of string tags for the subnet.
- Tenant
Id string - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- Value
Specs map[string]string - Map of additional options.
- List<String>
- The collection of ags assigned on the subnet, which have been explicitly and implicitly added.
- allocation
Pools List<SubnetAllocation Pool> - 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. Theallocation_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.
- dns
Nameservers 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.
- dns
Publish BooleanFixed Ip - Whether to publish DNS records for IPs from this subnet. Defaults is false.
- enable
Dhcp 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.
- gateway
Ip 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. - ip
Version Integer - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- ipv6Address
Mode String - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - ipv6Ra
Mode String - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - name String
- The name of the subnet. Changing this updates the name of the existing subnet.
- network
Id String - The UUID of the parent network. Changing this creates a new subnet.
- no
Gateway Boolean - Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.
- prefix
Length 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. - service
Types List<String> - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- subnetpool
Id String - The ID of the subnetpool associated with the subnet.
- List<String>
- A set of string tags for the subnet.
- tenant
Id String - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- value
Specs Map<String,String> - Map of additional options.
- string[]
- The collection of ags assigned on the subnet, which have been explicitly and implicitly added.
- allocation
Pools SubnetAllocation Pool[] - 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. Theallocation_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.
- dns
Nameservers 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.
- dns
Publish booleanFixed Ip - Whether to publish DNS records for IPs from this subnet. Defaults is false.
- enable
Dhcp 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.
- gateway
Ip 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. - ip
Version number - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- ipv6Address
Mode string - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - ipv6Ra
Mode string - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - name string
- The name of the subnet. Changing this updates the name of the existing subnet.
- network
Id string - The UUID of the parent network. Changing this creates a new subnet.
- no
Gateway boolean - Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.
- prefix
Length 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. - service
Types string[] - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- subnetpool
Id string - The ID of the subnetpool associated with the subnet.
- string[]
- A set of string tags for the subnet.
- tenant
Id string - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- value
Specs {[key: string]: string} - Map of additional options.
- Sequence[str]
- The collection of ags assigned on the subnet, which have been explicitly and implicitly added.
- allocation_
pools Sequence[SubnetAllocation Pool Args] - 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. Theallocation_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_ boolfixed_ ip - 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_ strmode - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - ipv6_
ra_ strmode - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - name str
- The name of the subnet. 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.
- 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.
- List<String>
- The collection of ags assigned on the subnet, which have been explicitly and implicitly added.
- allocation
Pools 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. Theallocation_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.
- dns
Nameservers 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.
- dns
Publish BooleanFixed Ip - Whether to publish DNS records for IPs from this subnet. Defaults is false.
- enable
Dhcp 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.
- gateway
Ip 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. - ip
Version Number - IP version, either 4 (default) or 6. Changing this creates a new subnet.
- ipv6Address
Mode String - The IPv6 address mode. Valid values are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - ipv6Ra
Mode String - The IPv6 Router Advertisement mode. Valid values
are
dhcpv6-stateful
,dhcpv6-stateless
, orslaac
. - name String
- The name of the subnet. Changing this updates the name of the existing subnet.
- network
Id String - The UUID of the parent network. Changing this creates a new subnet.
- no
Gateway Boolean - Do not set a gateway IP on this subnet. Changing this removes or adds a default gateway IP of the existing subnet.
- prefix
Length 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. - service
Types List<String> - An array of service types used by the subnet. Changing this updates the service types for the existing subnet.
- subnetpool
Id String - The ID of the subnetpool associated with the subnet.
- List<String>
- A set of string tags for the subnet.
- tenant
Id String - The owner of the subnet. Required if admin wants to create a subnet for another tenant. Changing this creates a new subnet.
- value
Specs Map<String> - Map of additional options.
Supporting Types
SubnetAllocationPool, SubnetAllocationPoolArgs
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.