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

netbox.Rack

Explore with Pulumi AI

From the official documentation:

The rack model represents a physical two- or four-post equipment rack in which devices can be installed. Each rack must be assigned to a site, and may optionally be assigned to a location within that site. Racks can also be organized by user-defined functional roles. The name and facility ID of each rack within a location must be unique.

Rack height is measured in rack units (U); racks are commonly between 42U and 48U tall, but NetBox allows you to define racks of arbitrary height. A toggle is provided to indicate whether rack units are in ascending (from the ground up) or descending order.

Each rack is assigned a name and (optionally) a separate facility ID. This is helpful when leasing space in a data center your organization does not own: The facility will often assign a seemingly arbitrary ID to a rack (for example, “M204.313”) whereas internally you refer to is simply as “R113.” A unique serial number and asset tag may also be associated with each rack.

Example Usage

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

const testSite = new netbox.Site("testSite", {status: "active"});
const testRack = new netbox.Rack("testRack", {
    siteId: testSite.siteId,
    status: "reserved",
    width: 19,
    uHeight: 48,
});
Copy
import pulumi
import pulumi_netbox as netbox

test_site = netbox.Site("testSite", status="active")
test_rack = netbox.Rack("testRack",
    site_id=test_site.site_id,
    status="reserved",
    width=19,
    u_height=48)
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 {
		testSite, err := netbox.NewSite(ctx, "testSite", &netbox.SiteArgs{
			Status: pulumi.String("active"),
		})
		if err != nil {
			return err
		}
		_, err = netbox.NewRack(ctx, "testRack", &netbox.RackArgs{
			SiteId:  testSite.SiteId,
			Status:  pulumi.String("reserved"),
			Width:   pulumi.Float64(19),
			UHeight: pulumi.Float64(48),
		})
		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 testSite = new Netbox.Site("testSite", new()
    {
        Status = "active",
    });

    var testRack = new Netbox.Rack("testRack", new()
    {
        SiteId = testSite.SiteId,
        Status = "reserved",
        Width = 19,
        UHeight = 48,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Site;
import com.pulumi.netbox.SiteArgs;
import com.pulumi.netbox.Rack;
import com.pulumi.netbox.RackArgs;
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 testSite = new Site("testSite", SiteArgs.builder()
            .status("active")
            .build());

        var testRack = new Rack("testRack", RackArgs.builder()
            .siteId(testSite.siteId())
            .status("reserved")
            .width(19)
            .uHeight(48)
            .build());

    }
}
Copy
resources:
  testSite:
    type: netbox:Site
    properties:
      status: active
  testRack:
    type: netbox:Rack
    properties:
      siteId: ${testSite.siteId}
      status: reserved
      width: 19
      uHeight: 48
Copy

Create Rack Resource

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

Constructor syntax

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

@overload
def Rack(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         site_id: Optional[float] = None,
         status: Optional[str] = None,
         form_factor: Optional[str] = None,
         name: Optional[str] = None,
         description: Optional[str] = None,
         facility_id: Optional[str] = None,
         asset_tag: Optional[str] = None,
         location_id: Optional[float] = None,
         max_weight: Optional[float] = None,
         rack_id: Optional[str] = None,
         outer_width: Optional[float] = None,
         outer_depth: Optional[float] = None,
         desc_units: Optional[bool] = None,
         outer_unit: Optional[str] = None,
         mounting_depth: Optional[float] = None,
         role_id: Optional[float] = None,
         serial: Optional[str] = None,
         custom_fields: Optional[Mapping[str, str]] = None,
         comments: Optional[str] = None,
         tags: Optional[Sequence[str]] = None,
         tenant_id: Optional[float] = None,
         u_height: Optional[float] = None,
         weight: Optional[float] = None,
         weight_unit: Optional[str] = None,
         width: Optional[float] = None)
func NewRack(ctx *Context, name string, args RackArgs, opts ...ResourceOption) (*Rack, error)
public Rack(string name, RackArgs args, CustomResourceOptions? opts = null)
public Rack(String name, RackArgs args)
public Rack(String name, RackArgs args, CustomResourceOptions options)
type: netbox:Rack
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 This property is required. RackArgs
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 This property is required. RackArgs
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 This property is required. RackArgs
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 This property is required. RackArgs
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. RackArgs
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 rackResource = new Netbox.Rack("rackResource", new()
{
    SiteId = 0,
    Status = "string",
    FormFactor = "string",
    Name = "string",
    Description = "string",
    FacilityId = "string",
    AssetTag = "string",
    LocationId = 0,
    MaxWeight = 0,
    RackId = "string",
    OuterWidth = 0,
    OuterDepth = 0,
    DescUnits = false,
    OuterUnit = "string",
    MountingDepth = 0,
    RoleId = 0,
    Serial = "string",
    CustomFields = 
    {
        { "string", "string" },
    },
    Comments = "string",
    Tags = new[]
    {
        "string",
    },
    TenantId = 0,
    UHeight = 0,
    Weight = 0,
    WeightUnit = "string",
    Width = 0,
});
Copy
example, err := netbox.NewRack(ctx, "rackResource", &netbox.RackArgs{
SiteId: pulumi.Float64(0),
Status: pulumi.String("string"),
FormFactor: pulumi.String("string"),
Name: pulumi.String("string"),
Description: pulumi.String("string"),
FacilityId: pulumi.String("string"),
AssetTag: pulumi.String("string"),
LocationId: pulumi.Float64(0),
MaxWeight: pulumi.Float64(0),
RackId: pulumi.String("string"),
OuterWidth: pulumi.Float64(0),
OuterDepth: pulumi.Float64(0),
DescUnits: pulumi.Bool(false),
OuterUnit: pulumi.String("string"),
MountingDepth: pulumi.Float64(0),
RoleId: pulumi.Float64(0),
Serial: pulumi.String("string"),
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
Comments: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
TenantId: pulumi.Float64(0),
UHeight: pulumi.Float64(0),
Weight: pulumi.Float64(0),
WeightUnit: pulumi.String("string"),
Width: pulumi.Float64(0),
})
Copy
var rackResource = new Rack("rackResource", RackArgs.builder()
    .siteId(0)
    .status("string")
    .formFactor("string")
    .name("string")
    .description("string")
    .facilityId("string")
    .assetTag("string")
    .locationId(0)
    .maxWeight(0)
    .rackId("string")
    .outerWidth(0)
    .outerDepth(0)
    .descUnits(false)
    .outerUnit("string")
    .mountingDepth(0)
    .roleId(0)
    .serial("string")
    .customFields(Map.of("string", "string"))
    .comments("string")
    .tags("string")
    .tenantId(0)
    .uHeight(0)
    .weight(0)
    .weightUnit("string")
    .width(0)
    .build());
Copy
rack_resource = netbox.Rack("rackResource",
    site_id=0,
    status="string",
    form_factor="string",
    name="string",
    description="string",
    facility_id="string",
    asset_tag="string",
    location_id=0,
    max_weight=0,
    rack_id="string",
    outer_width=0,
    outer_depth=0,
    desc_units=False,
    outer_unit="string",
    mounting_depth=0,
    role_id=0,
    serial="string",
    custom_fields={
        "string": "string",
    },
    comments="string",
    tags=["string"],
    tenant_id=0,
    u_height=0,
    weight=0,
    weight_unit="string",
    width=0)
Copy
const rackResource = new netbox.Rack("rackResource", {
    siteId: 0,
    status: "string",
    formFactor: "string",
    name: "string",
    description: "string",
    facilityId: "string",
    assetTag: "string",
    locationId: 0,
    maxWeight: 0,
    rackId: "string",
    outerWidth: 0,
    outerDepth: 0,
    descUnits: false,
    outerUnit: "string",
    mountingDepth: 0,
    roleId: 0,
    serial: "string",
    customFields: {
        string: "string",
    },
    comments: "string",
    tags: ["string"],
    tenantId: 0,
    uHeight: 0,
    weight: 0,
    weightUnit: "string",
    width: 0,
});
Copy
type: netbox:Rack
properties:
    assetTag: string
    comments: string
    customFields:
        string: string
    descUnits: false
    description: string
    facilityId: string
    formFactor: string
    locationId: 0
    maxWeight: 0
    mountingDepth: 0
    name: string
    outerDepth: 0
    outerUnit: string
    outerWidth: 0
    rackId: string
    roleId: 0
    serial: string
    siteId: 0
    status: string
    tags:
        - string
    tenantId: 0
    uHeight: 0
    weight: 0
    weightUnit: string
    width: 0
Copy

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

SiteId This property is required. double
Status This property is required. string
Valid values are reserved, available, planned, active and deprecated.
AssetTag string
Comments string
CustomFields Dictionary<string, string>
DescUnits bool
If rack units are descending. Defaults to false.
Description string
FacilityId string
FormFactor string
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
LocationId double
MaxWeight double
MountingDepth double
Name string
OuterDepth double
OuterUnit string
Valid values are mm and in. Required when outer_width and outer_depth is set.
OuterWidth double
RackId string
The ID of this resource.
RoleId double
Serial string
Tags List<string>
TenantId double
UHeight double
Weight double
WeightUnit string
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
Width double
Valid values are 10, 19, 21 and 23.
SiteId This property is required. float64
Status This property is required. string
Valid values are reserved, available, planned, active and deprecated.
AssetTag string
Comments string
CustomFields map[string]string
DescUnits bool
If rack units are descending. Defaults to false.
Description string
FacilityId string
FormFactor string
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
LocationId float64
MaxWeight float64
MountingDepth float64
Name string
OuterDepth float64
OuterUnit string
Valid values are mm and in. Required when outer_width and outer_depth is set.
OuterWidth float64
RackId string
The ID of this resource.
RoleId float64
Serial string
Tags []string
TenantId float64
UHeight float64
Weight float64
WeightUnit string
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
Width float64
Valid values are 10, 19, 21 and 23.
siteId This property is required. Double
status This property is required. String
Valid values are reserved, available, planned, active and deprecated.
assetTag String
comments String
customFields Map<String,String>
descUnits Boolean
If rack units are descending. Defaults to false.
description String
facilityId String
formFactor String
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
locationId Double
maxWeight Double
mountingDepth Double
name String
outerDepth Double
outerUnit String
Valid values are mm and in. Required when outer_width and outer_depth is set.
outerWidth Double
rackId String
The ID of this resource.
roleId Double
serial String
tags List<String>
tenantId Double
uHeight Double
weight Double
weightUnit String
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
width Double
Valid values are 10, 19, 21 and 23.
siteId This property is required. number
status This property is required. string
Valid values are reserved, available, planned, active and deprecated.
assetTag string
comments string
customFields {[key: string]: string}
descUnits boolean
If rack units are descending. Defaults to false.
description string
facilityId string
formFactor string
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
locationId number
maxWeight number
mountingDepth number
name string
outerDepth number
outerUnit string
Valid values are mm and in. Required when outer_width and outer_depth is set.
outerWidth number
rackId string
The ID of this resource.
roleId number
serial string
tags string[]
tenantId number
uHeight number
weight number
weightUnit string
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
width number
Valid values are 10, 19, 21 and 23.
site_id This property is required. float
status This property is required. str
Valid values are reserved, available, planned, active and deprecated.
asset_tag str
comments str
custom_fields Mapping[str, str]
desc_units bool
If rack units are descending. Defaults to false.
description str
facility_id str
form_factor str
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
location_id float
max_weight float
mounting_depth float
name str
outer_depth float
outer_unit str
Valid values are mm and in. Required when outer_width and outer_depth is set.
outer_width float
rack_id str
The ID of this resource.
role_id float
serial str
tags Sequence[str]
tenant_id float
u_height float
weight float
weight_unit str
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
width float
Valid values are 10, 19, 21 and 23.
siteId This property is required. Number
status This property is required. String
Valid values are reserved, available, planned, active and deprecated.
assetTag String
comments String
customFields Map<String>
descUnits Boolean
If rack units are descending. Defaults to false.
description String
facilityId String
formFactor String
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
locationId Number
maxWeight Number
mountingDepth Number
name String
outerDepth Number
outerUnit String
Valid values are mm and in. Required when outer_width and outer_depth is set.
outerWidth Number
rackId String
The ID of this resource.
roleId Number
serial String
tags List<String>
tenantId Number
uHeight Number
weight Number
weightUnit String
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
width Number
Valid values are 10, 19, 21 and 23.

Outputs

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

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

Look up Existing Rack Resource

Get an existing Rack 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?: RackState, opts?: CustomResourceOptions): Rack
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        asset_tag: Optional[str] = None,
        comments: Optional[str] = None,
        custom_fields: Optional[Mapping[str, str]] = None,
        desc_units: Optional[bool] = None,
        description: Optional[str] = None,
        facility_id: Optional[str] = None,
        form_factor: Optional[str] = None,
        location_id: Optional[float] = None,
        max_weight: Optional[float] = None,
        mounting_depth: Optional[float] = None,
        name: Optional[str] = None,
        outer_depth: Optional[float] = None,
        outer_unit: Optional[str] = None,
        outer_width: Optional[float] = None,
        rack_id: Optional[str] = None,
        role_id: Optional[float] = None,
        serial: Optional[str] = None,
        site_id: Optional[float] = None,
        status: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        tenant_id: Optional[float] = None,
        u_height: Optional[float] = None,
        weight: Optional[float] = None,
        weight_unit: Optional[str] = None,
        width: Optional[float] = None) -> Rack
func GetRack(ctx *Context, name string, id IDInput, state *RackState, opts ...ResourceOption) (*Rack, error)
public static Rack Get(string name, Input<string> id, RackState? state, CustomResourceOptions? opts = null)
public static Rack get(String name, Output<String> id, RackState state, CustomResourceOptions options)
resources:  _:    type: netbox:Rack    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:
AssetTag string
Comments string
CustomFields Dictionary<string, string>
DescUnits bool
If rack units are descending. Defaults to false.
Description string
FacilityId string
FormFactor string
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
LocationId double
MaxWeight double
MountingDepth double
Name string
OuterDepth double
OuterUnit string
Valid values are mm and in. Required when outer_width and outer_depth is set.
OuterWidth double
RackId string
The ID of this resource.
RoleId double
Serial string
SiteId double
Status string
Valid values are reserved, available, planned, active and deprecated.
Tags List<string>
TenantId double
UHeight double
Weight double
WeightUnit string
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
Width double
Valid values are 10, 19, 21 and 23.
AssetTag string
Comments string
CustomFields map[string]string
DescUnits bool
If rack units are descending. Defaults to false.
Description string
FacilityId string
FormFactor string
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
LocationId float64
MaxWeight float64
MountingDepth float64
Name string
OuterDepth float64
OuterUnit string
Valid values are mm and in. Required when outer_width and outer_depth is set.
OuterWidth float64
RackId string
The ID of this resource.
RoleId float64
Serial string
SiteId float64
Status string
Valid values are reserved, available, planned, active and deprecated.
Tags []string
TenantId float64
UHeight float64
Weight float64
WeightUnit string
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
Width float64
Valid values are 10, 19, 21 and 23.
assetTag String
comments String
customFields Map<String,String>
descUnits Boolean
If rack units are descending. Defaults to false.
description String
facilityId String
formFactor String
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
locationId Double
maxWeight Double
mountingDepth Double
name String
outerDepth Double
outerUnit String
Valid values are mm and in. Required when outer_width and outer_depth is set.
outerWidth Double
rackId String
The ID of this resource.
roleId Double
serial String
siteId Double
status String
Valid values are reserved, available, planned, active and deprecated.
tags List<String>
tenantId Double
uHeight Double
weight Double
weightUnit String
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
width Double
Valid values are 10, 19, 21 and 23.
assetTag string
comments string
customFields {[key: string]: string}
descUnits boolean
If rack units are descending. Defaults to false.
description string
facilityId string
formFactor string
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
locationId number
maxWeight number
mountingDepth number
name string
outerDepth number
outerUnit string
Valid values are mm and in. Required when outer_width and outer_depth is set.
outerWidth number
rackId string
The ID of this resource.
roleId number
serial string
siteId number
status string
Valid values are reserved, available, planned, active and deprecated.
tags string[]
tenantId number
uHeight number
weight number
weightUnit string
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
width number
Valid values are 10, 19, 21 and 23.
asset_tag str
comments str
custom_fields Mapping[str, str]
desc_units bool
If rack units are descending. Defaults to false.
description str
facility_id str
form_factor str
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
location_id float
max_weight float
mounting_depth float
name str
outer_depth float
outer_unit str
Valid values are mm and in. Required when outer_width and outer_depth is set.
outer_width float
rack_id str
The ID of this resource.
role_id float
serial str
site_id float
status str
Valid values are reserved, available, planned, active and deprecated.
tags Sequence[str]
tenant_id float
u_height float
weight float
weight_unit str
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
width float
Valid values are 10, 19, 21 and 23.
assetTag String
comments String
customFields Map<String>
descUnits Boolean
If rack units are descending. Defaults to false.
description String
facilityId String
formFactor String
Valid values are 2-post-frame, 4-post-frame, 4-post-cabinet, wall-frame, wall-frame-vertical, wall-cabinet and wall-cabinet-vertical.
locationId Number
maxWeight Number
mountingDepth Number
name String
outerDepth Number
outerUnit String
Valid values are mm and in. Required when outer_width and outer_depth is set.
outerWidth Number
rackId String
The ID of this resource.
roleId Number
serial String
siteId Number
status String
Valid values are reserved, available, planned, active and deprecated.
tags List<String>
tenantId Number
uHeight Number
weight Number
weightUnit String
Valid values are kg, g, lb and oz. Required when weight and max_weight is set.
width Number
Valid values are 10, 19, 21 and 23.

Package Details

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