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)});
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)
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
})
}
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),
});
});
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());
}
}
resources:
testAvailableIpAddress:
type: netbox:AvailableIpAddress
properties:
prefixId: ${testPrefix.id}
variables:
testPrefix:
fn::invoke:
function: netbox:getPrefix
arguments:
cidr: 10.0.0.0/24
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());
}
}
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
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 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 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 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 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 String
- The unique name of the resource.
- args 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,
});
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),
})
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());
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)
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,
});
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
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:
- Available
Ip stringAddress Id - The ID of this resource.
- Description string
- Device
Interface doubleId - Conflicts with
interface_id
andvirtual_machine_interface_id
. - Dns
Name string - Interface
Id double - Required when
object_type
is set. - Ip
Range doubleId - Exactly one of
prefix_id
orip_range_id
must be given. - Object
Type string - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - Prefix
Id double - Exactly one of
prefix_id
orip_range_id
must be given. - Role string
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - Status string
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - List<string>
- Tenant
Id double - Virtual
Machine doubleInterface Id - Conflicts with
interface_id
anddevice_interface_id
. - Vrf
Id double
- Available
Ip stringAddress Id - The ID of this resource.
- Description string
- Device
Interface float64Id - Conflicts with
interface_id
andvirtual_machine_interface_id
. - Dns
Name string - Interface
Id float64 - Required when
object_type
is set. - Ip
Range float64Id - Exactly one of
prefix_id
orip_range_id
must be given. - Object
Type string - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - Prefix
Id float64 - Exactly one of
prefix_id
orip_range_id
must be given. - Role string
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - Status string
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - []string
- Tenant
Id float64 - Virtual
Machine float64Interface Id - Conflicts with
interface_id
anddevice_interface_id
. - Vrf
Id float64
- available
Ip StringAddress Id - The ID of this resource.
- description String
- device
Interface DoubleId - Conflicts with
interface_id
andvirtual_machine_interface_id
. - dns
Name String - interface
Id Double - Required when
object_type
is set. - ip
Range DoubleId - Exactly one of
prefix_id
orip_range_id
must be given. - object
Type String - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - prefix
Id Double - Exactly one of
prefix_id
orip_range_id
must be given. - role String
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - status String
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - List<String>
- tenant
Id Double - virtual
Machine DoubleInterface Id - Conflicts with
interface_id
anddevice_interface_id
. - vrf
Id Double
- available
Ip stringAddress Id - The ID of this resource.
- description string
- device
Interface numberId - Conflicts with
interface_id
andvirtual_machine_interface_id
. - dns
Name string - interface
Id number - Required when
object_type
is set. - ip
Range numberId - Exactly one of
prefix_id
orip_range_id
must be given. - object
Type string - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - prefix
Id number - Exactly one of
prefix_id
orip_range_id
must be given. - role string
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - status string
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - string[]
- tenant
Id number - virtual
Machine numberInterface Id - Conflicts with
interface_id
anddevice_interface_id
. - vrf
Id number
- available_
ip_ straddress_ id - The ID of this resource.
- description str
- device_
interface_ floatid - Conflicts with
interface_id
andvirtual_machine_interface_id
. - dns_
name str - interface_
id float - Required when
object_type
is set. - ip_
range_ floatid - Exactly one of
prefix_id
orip_range_id
must be given. - object_
type str - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - prefix_
id float - Exactly one of
prefix_id
orip_range_id
must be given. - role str
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - status str
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - Sequence[str]
- tenant_
id float - virtual_
machine_ floatinterface_ id - Conflicts with
interface_id
anddevice_interface_id
. - vrf_
id float
- available
Ip StringAddress Id - The ID of this resource.
- description String
- device
Interface NumberId - Conflicts with
interface_id
andvirtual_machine_interface_id
. - dns
Name String - interface
Id Number - Required when
object_type
is set. - ip
Range NumberId - Exactly one of
prefix_id
orip_range_id
must be given. - object
Type String - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - prefix
Id Number - Exactly one of
prefix_id
orip_range_id
must be given. - role String
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - status String
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - List<String>
- tenant
Id Number - virtual
Machine NumberInterface Id - Conflicts with
interface_id
anddevice_interface_id
. - vrf
Id Number
Outputs
All input properties are implicitly available as output properties. Additionally, the AvailableIpAddress resource produces the following output properties:
- id str
- The provider-assigned unique ID for this managed resource.
- ip_
address str
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
- 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.
- Available
Ip stringAddress Id - The ID of this resource.
- Description string
- Device
Interface doubleId - Conflicts with
interface_id
andvirtual_machine_interface_id
. - Dns
Name string - Interface
Id double - Required when
object_type
is set. - Ip
Address string - Ip
Range doubleId - Exactly one of
prefix_id
orip_range_id
must be given. - Object
Type string - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - Prefix
Id double - Exactly one of
prefix_id
orip_range_id
must be given. - Role string
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - Status string
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - List<string>
- Tenant
Id double - Virtual
Machine doubleInterface Id - Conflicts with
interface_id
anddevice_interface_id
. - Vrf
Id double
- Available
Ip stringAddress Id - The ID of this resource.
- Description string
- Device
Interface float64Id - Conflicts with
interface_id
andvirtual_machine_interface_id
. - Dns
Name string - Interface
Id float64 - Required when
object_type
is set. - Ip
Address string - Ip
Range float64Id - Exactly one of
prefix_id
orip_range_id
must be given. - Object
Type string - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - Prefix
Id float64 - Exactly one of
prefix_id
orip_range_id
must be given. - Role string
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - Status string
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - []string
- Tenant
Id float64 - Virtual
Machine float64Interface Id - Conflicts with
interface_id
anddevice_interface_id
. - Vrf
Id float64
- available
Ip StringAddress Id - The ID of this resource.
- description String
- device
Interface DoubleId - Conflicts with
interface_id
andvirtual_machine_interface_id
. - dns
Name String - interface
Id Double - Required when
object_type
is set. - ip
Address String - ip
Range DoubleId - Exactly one of
prefix_id
orip_range_id
must be given. - object
Type String - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - prefix
Id Double - Exactly one of
prefix_id
orip_range_id
must be given. - role String
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - status String
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - List<String>
- tenant
Id Double - virtual
Machine DoubleInterface Id - Conflicts with
interface_id
anddevice_interface_id
. - vrf
Id Double
- available
Ip stringAddress Id - The ID of this resource.
- description string
- device
Interface numberId - Conflicts with
interface_id
andvirtual_machine_interface_id
. - dns
Name string - interface
Id number - Required when
object_type
is set. - ip
Address string - ip
Range numberId - Exactly one of
prefix_id
orip_range_id
must be given. - object
Type string - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - prefix
Id number - Exactly one of
prefix_id
orip_range_id
must be given. - role string
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - status string
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - string[]
- tenant
Id number - virtual
Machine numberInterface Id - Conflicts with
interface_id
anddevice_interface_id
. - vrf
Id number
- available_
ip_ straddress_ id - The ID of this resource.
- description str
- device_
interface_ floatid - Conflicts with
interface_id
andvirtual_machine_interface_id
. - dns_
name str - interface_
id float - Required when
object_type
is set. - ip_
address str - ip_
range_ floatid - Exactly one of
prefix_id
orip_range_id
must be given. - object_
type str - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - prefix_
id float - Exactly one of
prefix_id
orip_range_id
must be given. - role str
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - status str
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - Sequence[str]
- tenant_
id float - virtual_
machine_ floatinterface_ id - Conflicts with
interface_id
anddevice_interface_id
. - vrf_
id float
- available
Ip StringAddress Id - The ID of this resource.
- description String
- device
Interface NumberId - Conflicts with
interface_id
andvirtual_machine_interface_id
. - dns
Name String - interface
Id Number - Required when
object_type
is set. - ip
Address String - ip
Range NumberId - Exactly one of
prefix_id
orip_range_id
must be given. - object
Type String - Valid values are
virtualization.vminterface
anddcim.interface
. Required wheninterface_id
is set. - prefix
Id Number - Exactly one of
prefix_id
orip_range_id
must be given. - role String
- Valid values are
loopback
,secondary
,anycast
,vip
,vrrp
,hsrp
,glbp
andcarp
. - status String
- Valid values are
active
,reserved
,deprecated
,dhcp
andslaac
. Defaults toactive
. - List<String>
- tenant
Id Number - virtual
Machine NumberInterface Id - Conflicts with
interface_id
anddevice_interface_id
. - vrf
Id Number
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.