1. Packages
  2. Netbox Provider
  3. API Docs
  4. AvailableIpAddress
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

netbox.AvailableIpAddress

Explore with Pulumi AI

Per the docs:

An IP address comprises a single host address (either IPv4 or IPv6) and its subnet mask. Its mask should match exactly how the IP address is configured on an interface in the real world. Like a prefix, an IP address can optionally be assigned to a VRF (otherwise, it will appear in the “global” table). IP addresses are automatically arranged under parent prefixes within their respective VRFs according to the IP hierarchya.

Each IP address can also be assigned an operational status and a functional role. Statuses are hard-coded in NetBox and include the following:

  • Active
  • Reserved
  • Deprecated
  • DHCP
  • SLAAC (IPv6 Stateless Address Autoconfiguration)

This resource will retrieve the next available IP address from a given prefix or IP range (specified by ID)

Example Usage

Creating an IP in a prefix

import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";

const testPrefix = netbox.getPrefix({
    cidr: "10.0.0.0/24",
});
const testAvailableIpAddress = new netbox.AvailableIpAddress("testAvailableIpAddress", {prefixId: testPrefix.then(testPrefix => testPrefix.id)});
Copy
import pulumi
import pulumi_netbox as netbox

test_prefix = netbox.get_prefix(cidr="10.0.0.0/24")
test_available_ip_address = netbox.AvailableIpAddress("testAvailableIpAddress", prefix_id=test_prefix.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/netbox"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testPrefix, err := netbox.LookupPrefix(ctx, &netbox.LookupPrefixArgs{
			Cidr: pulumi.StringRef("10.0.0.0/24"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = netbox.NewAvailableIpAddress(ctx, "testAvailableIpAddress", &netbox.AvailableIpAddressArgs{
			PrefixId: pulumi.Float64(testPrefix.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;

return await Deployment.RunAsync(() => 
{
    var testPrefix = Netbox.GetPrefix.Invoke(new()
    {
        Cidr = "10.0.0.0/24",
    });

    var testAvailableIpAddress = new Netbox.AvailableIpAddress("testAvailableIpAddress", new()
    {
        PrefixId = testPrefix.Apply(getPrefixResult => getPrefixResult.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.NetboxFunctions;
import com.pulumi.netbox.inputs.GetPrefixArgs;
import com.pulumi.netbox.AvailableIpAddress;
import com.pulumi.netbox.AvailableIpAddressArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var testPrefix = NetboxFunctions.getPrefix(GetPrefixArgs.builder()
            .cidr("10.0.0.0/24")
            .build());

        var testAvailableIpAddress = new AvailableIpAddress("testAvailableIpAddress", AvailableIpAddressArgs.builder()
            .prefixId(testPrefix.applyValue(getPrefixResult -> getPrefixResult.id()))
            .build());

    }
}
Copy
resources:
  testAvailableIpAddress:
    type: netbox:AvailableIpAddress
    properties:
      prefixId: ${testPrefix.id}
variables:
  testPrefix:
    fn::invoke:
      function: netbox:getPrefix
      arguments:
        cidr: 10.0.0.0/24
Copy

Creating an IP in an IP range

Coming soon!
Coming soon!
Coming soon!
Coming soon!
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.NetboxFunctions;
import com.pulumi.netbox.inputs.GetIpRangeArgs;
import com.pulumi.netbox.AvailableIpAddress;
import com.pulumi.netbox.AvailableIpAddressArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var testIpRange = NetboxFunctions.getIpRange(GetIpRangeArgs.builder()
            .startAddress("10.0.0.1/24")
            .endAddress("10.0.0.50/24")
            .build());

        var testAvailableIpAddress = new AvailableIpAddress("testAvailableIpAddress", AvailableIpAddressArgs.builder()
            .ipRangeId(testIpRange.applyValue(getIpRangeResult -> getIpRangeResult.id()))
            .build());

    }
}
Copy
resources:
  testAvailableIpAddress:
    type: netbox:AvailableIpAddress
    properties:
      ipRangeId: ${testIpRange.id}
variables:
  testIpRange:
    fn::invoke:
      function: netbox:getIpRange
      arguments:
        startAddress: 10.0.0.1/24
        endAddress: 10.0.0.50/24
Copy

Create AvailableIpAddress Resource

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

Constructor syntax

new AvailableIpAddress(name: string, args?: AvailableIpAddressArgs, opts?: CustomResourceOptions);
@overload
def AvailableIpAddress(resource_name: str,
                       args: Optional[AvailableIpAddressArgs] = None,
                       opts: Optional[ResourceOptions] = None)

@overload
def AvailableIpAddress(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       available_ip_address_id: Optional[str] = None,
                       description: Optional[str] = None,
                       device_interface_id: Optional[float] = None,
                       dns_name: Optional[str] = None,
                       interface_id: Optional[float] = None,
                       ip_range_id: Optional[float] = None,
                       object_type: Optional[str] = None,
                       prefix_id: Optional[float] = None,
                       role: Optional[str] = None,
                       status: Optional[str] = None,
                       tags: Optional[Sequence[str]] = None,
                       tenant_id: Optional[float] = None,
                       virtual_machine_interface_id: Optional[float] = None,
                       vrf_id: Optional[float] = None)
func NewAvailableIpAddress(ctx *Context, name string, args *AvailableIpAddressArgs, opts ...ResourceOption) (*AvailableIpAddress, error)
public AvailableIpAddress(string name, AvailableIpAddressArgs? args = null, CustomResourceOptions? opts = null)
public AvailableIpAddress(String name, AvailableIpAddressArgs args)
public AvailableIpAddress(String name, AvailableIpAddressArgs args, CustomResourceOptions options)
type: netbox:AvailableIpAddress
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args AvailableIpAddressArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args AvailableIpAddressArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args AvailableIpAddressArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args AvailableIpAddressArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AvailableIpAddressArgs
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 availableIpAddressResource = new Netbox.AvailableIpAddress("availableIpAddressResource", new()
{
    AvailableIpAddressId = "string",
    Description = "string",
    DeviceInterfaceId = 0,
    DnsName = "string",
    InterfaceId = 0,
    IpRangeId = 0,
    ObjectType = "string",
    PrefixId = 0,
    Role = "string",
    Status = "string",
    Tags = new[]
    {
        "string",
    },
    TenantId = 0,
    VirtualMachineInterfaceId = 0,
    VrfId = 0,
});
Copy
example, err := netbox.NewAvailableIpAddress(ctx, "availableIpAddressResource", &netbox.AvailableIpAddressArgs{
AvailableIpAddressId: pulumi.String("string"),
Description: pulumi.String("string"),
DeviceInterfaceId: pulumi.Float64(0),
DnsName: pulumi.String("string"),
InterfaceId: pulumi.Float64(0),
IpRangeId: pulumi.Float64(0),
ObjectType: pulumi.String("string"),
PrefixId: pulumi.Float64(0),
Role: pulumi.String("string"),
Status: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
TenantId: pulumi.Float64(0),
VirtualMachineInterfaceId: pulumi.Float64(0),
VrfId: pulumi.Float64(0),
})
Copy
var availableIpAddressResource = new AvailableIpAddress("availableIpAddressResource", AvailableIpAddressArgs.builder()
    .availableIpAddressId("string")
    .description("string")
    .deviceInterfaceId(0)
    .dnsName("string")
    .interfaceId(0)
    .ipRangeId(0)
    .objectType("string")
    .prefixId(0)
    .role("string")
    .status("string")
    .tags("string")
    .tenantId(0)
    .virtualMachineInterfaceId(0)
    .vrfId(0)
    .build());
Copy
available_ip_address_resource = netbox.AvailableIpAddress("availableIpAddressResource",
    available_ip_address_id="string",
    description="string",
    device_interface_id=0,
    dns_name="string",
    interface_id=0,
    ip_range_id=0,
    object_type="string",
    prefix_id=0,
    role="string",
    status="string",
    tags=["string"],
    tenant_id=0,
    virtual_machine_interface_id=0,
    vrf_id=0)
Copy
const availableIpAddressResource = new netbox.AvailableIpAddress("availableIpAddressResource", {
    availableIpAddressId: "string",
    description: "string",
    deviceInterfaceId: 0,
    dnsName: "string",
    interfaceId: 0,
    ipRangeId: 0,
    objectType: "string",
    prefixId: 0,
    role: "string",
    status: "string",
    tags: ["string"],
    tenantId: 0,
    virtualMachineInterfaceId: 0,
    vrfId: 0,
});
Copy
type: netbox:AvailableIpAddress
properties:
    availableIpAddressId: string
    description: string
    deviceInterfaceId: 0
    dnsName: string
    interfaceId: 0
    ipRangeId: 0
    objectType: string
    prefixId: 0
    role: string
    status: string
    tags:
        - string
    tenantId: 0
    virtualMachineInterfaceId: 0
    vrfId: 0
Copy

AvailableIpAddress 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 AvailableIpAddress resource accepts the following input properties:

AvailableIpAddressId string
The ID of this resource.
Description string
DeviceInterfaceId double
Conflicts with interface_id and virtual_machine_interface_id.
DnsName string
InterfaceId double
Required when object_type is set.
IpRangeId double
Exactly one of prefix_id or ip_range_id must be given.
ObjectType string
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
PrefixId double
Exactly one of prefix_id or ip_range_id must be given.
Role string
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
Status string
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
Tags List<string>
TenantId double
VirtualMachineInterfaceId double
Conflicts with interface_id and device_interface_id.
VrfId double
AvailableIpAddressId string
The ID of this resource.
Description string
DeviceInterfaceId float64
Conflicts with interface_id and virtual_machine_interface_id.
DnsName string
InterfaceId float64
Required when object_type is set.
IpRangeId float64
Exactly one of prefix_id or ip_range_id must be given.
ObjectType string
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
PrefixId float64
Exactly one of prefix_id or ip_range_id must be given.
Role string
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
Status string
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
Tags []string
TenantId float64
VirtualMachineInterfaceId float64
Conflicts with interface_id and device_interface_id.
VrfId float64
availableIpAddressId String
The ID of this resource.
description String
deviceInterfaceId Double
Conflicts with interface_id and virtual_machine_interface_id.
dnsName String
interfaceId Double
Required when object_type is set.
ipRangeId Double
Exactly one of prefix_id or ip_range_id must be given.
objectType String
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
prefixId Double
Exactly one of prefix_id or ip_range_id must be given.
role String
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
status String
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
tags List<String>
tenantId Double
virtualMachineInterfaceId Double
Conflicts with interface_id and device_interface_id.
vrfId Double
availableIpAddressId string
The ID of this resource.
description string
deviceInterfaceId number
Conflicts with interface_id and virtual_machine_interface_id.
dnsName string
interfaceId number
Required when object_type is set.
ipRangeId number
Exactly one of prefix_id or ip_range_id must be given.
objectType string
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
prefixId number
Exactly one of prefix_id or ip_range_id must be given.
role string
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
status string
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
tags string[]
tenantId number
virtualMachineInterfaceId number
Conflicts with interface_id and device_interface_id.
vrfId number
available_ip_address_id str
The ID of this resource.
description str
device_interface_id float
Conflicts with interface_id and virtual_machine_interface_id.
dns_name str
interface_id float
Required when object_type is set.
ip_range_id float
Exactly one of prefix_id or ip_range_id must be given.
object_type str
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
prefix_id float
Exactly one of prefix_id or ip_range_id must be given.
role str
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
status str
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
tags Sequence[str]
tenant_id float
virtual_machine_interface_id float
Conflicts with interface_id and device_interface_id.
vrf_id float
availableIpAddressId String
The ID of this resource.
description String
deviceInterfaceId Number
Conflicts with interface_id and virtual_machine_interface_id.
dnsName String
interfaceId Number
Required when object_type is set.
ipRangeId Number
Exactly one of prefix_id or ip_range_id must be given.
objectType String
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
prefixId Number
Exactly one of prefix_id or ip_range_id must be given.
role String
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
status String
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
tags List<String>
tenantId Number
virtualMachineInterfaceId Number
Conflicts with interface_id and device_interface_id.
vrfId Number

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
IpAddress string
Id string
The provider-assigned unique ID for this managed resource.
IpAddress string
id String
The provider-assigned unique ID for this managed resource.
ipAddress String
id string
The provider-assigned unique ID for this managed resource.
ipAddress string
id str
The provider-assigned unique ID for this managed resource.
ip_address str
id String
The provider-assigned unique ID for this managed resource.
ipAddress String

Look up Existing AvailableIpAddress Resource

Get an existing AvailableIpAddress 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?: AvailableIpAddressState, opts?: CustomResourceOptions): AvailableIpAddress
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        available_ip_address_id: Optional[str] = None,
        description: Optional[str] = None,
        device_interface_id: Optional[float] = None,
        dns_name: Optional[str] = None,
        interface_id: Optional[float] = None,
        ip_address: Optional[str] = None,
        ip_range_id: Optional[float] = None,
        object_type: Optional[str] = None,
        prefix_id: Optional[float] = None,
        role: Optional[str] = None,
        status: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        tenant_id: Optional[float] = None,
        virtual_machine_interface_id: Optional[float] = None,
        vrf_id: Optional[float] = None) -> AvailableIpAddress
func GetAvailableIpAddress(ctx *Context, name string, id IDInput, state *AvailableIpAddressState, opts ...ResourceOption) (*AvailableIpAddress, error)
public static AvailableIpAddress Get(string name, Input<string> id, AvailableIpAddressState? state, CustomResourceOptions? opts = null)
public static AvailableIpAddress get(String name, Output<String> id, AvailableIpAddressState state, CustomResourceOptions options)
resources:  _:    type: netbox:AvailableIpAddress    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AvailableIpAddressId string
The ID of this resource.
Description string
DeviceInterfaceId double
Conflicts with interface_id and virtual_machine_interface_id.
DnsName string
InterfaceId double
Required when object_type is set.
IpAddress string
IpRangeId double
Exactly one of prefix_id or ip_range_id must be given.
ObjectType string
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
PrefixId double
Exactly one of prefix_id or ip_range_id must be given.
Role string
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
Status string
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
Tags List<string>
TenantId double
VirtualMachineInterfaceId double
Conflicts with interface_id and device_interface_id.
VrfId double
AvailableIpAddressId string
The ID of this resource.
Description string
DeviceInterfaceId float64
Conflicts with interface_id and virtual_machine_interface_id.
DnsName string
InterfaceId float64
Required when object_type is set.
IpAddress string
IpRangeId float64
Exactly one of prefix_id or ip_range_id must be given.
ObjectType string
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
PrefixId float64
Exactly one of prefix_id or ip_range_id must be given.
Role string
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
Status string
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
Tags []string
TenantId float64
VirtualMachineInterfaceId float64
Conflicts with interface_id and device_interface_id.
VrfId float64
availableIpAddressId String
The ID of this resource.
description String
deviceInterfaceId Double
Conflicts with interface_id and virtual_machine_interface_id.
dnsName String
interfaceId Double
Required when object_type is set.
ipAddress String
ipRangeId Double
Exactly one of prefix_id or ip_range_id must be given.
objectType String
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
prefixId Double
Exactly one of prefix_id or ip_range_id must be given.
role String
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
status String
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
tags List<String>
tenantId Double
virtualMachineInterfaceId Double
Conflicts with interface_id and device_interface_id.
vrfId Double
availableIpAddressId string
The ID of this resource.
description string
deviceInterfaceId number
Conflicts with interface_id and virtual_machine_interface_id.
dnsName string
interfaceId number
Required when object_type is set.
ipAddress string
ipRangeId number
Exactly one of prefix_id or ip_range_id must be given.
objectType string
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
prefixId number
Exactly one of prefix_id or ip_range_id must be given.
role string
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
status string
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
tags string[]
tenantId number
virtualMachineInterfaceId number
Conflicts with interface_id and device_interface_id.
vrfId number
available_ip_address_id str
The ID of this resource.
description str
device_interface_id float
Conflicts with interface_id and virtual_machine_interface_id.
dns_name str
interface_id float
Required when object_type is set.
ip_address str
ip_range_id float
Exactly one of prefix_id or ip_range_id must be given.
object_type str
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
prefix_id float
Exactly one of prefix_id or ip_range_id must be given.
role str
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
status str
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
tags Sequence[str]
tenant_id float
virtual_machine_interface_id float
Conflicts with interface_id and device_interface_id.
vrf_id float
availableIpAddressId String
The ID of this resource.
description String
deviceInterfaceId Number
Conflicts with interface_id and virtual_machine_interface_id.
dnsName String
interfaceId Number
Required when object_type is set.
ipAddress String
ipRangeId Number
Exactly one of prefix_id or ip_range_id must be given.
objectType String
Valid values are virtualization.vminterface and dcim.interface. Required when interface_id is set.
prefixId Number
Exactly one of prefix_id or ip_range_id must be given.
role String
Valid values are loopback, secondary, anycast, vip, vrrp, hsrp, glbp and carp.
status String
Valid values are active, reserved, deprecated, dhcp and slaac. Defaults to active.
tags List<String>
tenantId Number
virtualMachineInterfaceId Number
Conflicts with interface_id and device_interface_id.
vrfId Number

Package Details

Repository
netbox e-breuninger/terraform-provider-netbox
License
Notes
This Pulumi package is based on the netbox Terraform Provider.