1. Packages
  2. Netbox Provider
  3. API Docs
  4. DeviceBay
netbox 5.0.0 published on Friday, Sep 12, 2025 by e-breuninger

netbox.DeviceBay

Explore with Pulumi AI

netbox logo
netbox 5.0.0 published on Friday, Sep 12, 2025 by e-breuninger

    From the official documentation:

    Device bays represent a space or slot within a device in which a field-replaceable device may be installed. A common example is that of a chassis-based server that holds a number of blades which may contain device components that don’t fit the module pattern. Devices in turn hold additional components that become available to the parent device.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const exampleTenant = new netbox.Tenant("exampleTenant", {});
    const exampleSite = new netbox.Site("exampleSite", {status: "active"});
    const exampleManufacturer = new netbox.Manufacturer("exampleManufacturer", {});
    const exampleDeviceType = new netbox.DeviceType("exampleDeviceType", {
        model: "example_device_type",
        manufacturerId: exampleManufacturer.manufacturerId,
        subdeviceRole: "parent",
    });
    const exampleInstalledDeviceType = new netbox.DeviceType("exampleInstalledDeviceType", {
        model: "example_device_type_installed",
        manufacturerId: exampleManufacturer.manufacturerId,
        uHeight: 0,
        subdeviceRole: "child",
    });
    const exampleDeviceRole = new netbox.DeviceRole("exampleDeviceRole", {colorHex: "123456"});
    const exampleDevice = new netbox.Device("exampleDevice", {
        deviceTypeId: exampleDeviceType.deviceTypeId,
        tenantId: exampleTenant.tenantId,
        roleId: exampleDeviceRole.deviceRoleId,
        siteId: exampleSite.siteId,
    });
    const exampleInstalledDevice = new netbox.Device("exampleInstalledDevice", {
        deviceTypeId: exampleInstalledDeviceType.deviceTypeId,
        tenantId: exampleTenant.tenantId,
        roleId: exampleDeviceRole.deviceRoleId,
        siteId: exampleSite.siteId,
    });
    const exampleDeviceBay = new netbox.DeviceBay("exampleDeviceBay", {
        deviceId: exampleDevice.deviceId,
        label: "example_label",
        description: "example_description",
        installedDeviceId: exampleInstalledDevice.deviceId,
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    example_tenant = netbox.Tenant("exampleTenant")
    example_site = netbox.Site("exampleSite", status="active")
    example_manufacturer = netbox.Manufacturer("exampleManufacturer")
    example_device_type = netbox.DeviceType("exampleDeviceType",
        model="example_device_type",
        manufacturer_id=example_manufacturer.manufacturer_id,
        subdevice_role="parent")
    example_installed_device_type = netbox.DeviceType("exampleInstalledDeviceType",
        model="example_device_type_installed",
        manufacturer_id=example_manufacturer.manufacturer_id,
        u_height=0,
        subdevice_role="child")
    example_device_role = netbox.DeviceRole("exampleDeviceRole", color_hex="123456")
    example_device = netbox.Device("exampleDevice",
        device_type_id=example_device_type.device_type_id,
        tenant_id=example_tenant.tenant_id,
        role_id=example_device_role.device_role_id,
        site_id=example_site.site_id)
    example_installed_device = netbox.Device("exampleInstalledDevice",
        device_type_id=example_installed_device_type.device_type_id,
        tenant_id=example_tenant.tenant_id,
        role_id=example_device_role.device_role_id,
        site_id=example_site.site_id)
    example_device_bay = netbox.DeviceBay("exampleDeviceBay",
        device_id=example_device.device_id,
        label="example_label",
        description="example_description",
        installed_device_id=example_installed_device.device_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v5/netbox"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleTenant, err := netbox.NewTenant(ctx, "exampleTenant", nil)
    		if err != nil {
    			return err
    		}
    		exampleSite, err := netbox.NewSite(ctx, "exampleSite", &netbox.SiteArgs{
    			Status: pulumi.String("active"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleManufacturer, err := netbox.NewManufacturer(ctx, "exampleManufacturer", nil)
    		if err != nil {
    			return err
    		}
    		exampleDeviceType, err := netbox.NewDeviceType(ctx, "exampleDeviceType", &netbox.DeviceTypeArgs{
    			Model:          pulumi.String("example_device_type"),
    			ManufacturerId: exampleManufacturer.ManufacturerId,
    			SubdeviceRole:  pulumi.String("parent"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleInstalledDeviceType, err := netbox.NewDeviceType(ctx, "exampleInstalledDeviceType", &netbox.DeviceTypeArgs{
    			Model:          pulumi.String("example_device_type_installed"),
    			ManufacturerId: exampleManufacturer.ManufacturerId,
    			UHeight:        pulumi.Float64(0),
    			SubdeviceRole:  pulumi.String("child"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleDeviceRole, err := netbox.NewDeviceRole(ctx, "exampleDeviceRole", &netbox.DeviceRoleArgs{
    			ColorHex: pulumi.String("123456"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleDevice, err := netbox.NewDevice(ctx, "exampleDevice", &netbox.DeviceArgs{
    			DeviceTypeId: exampleDeviceType.DeviceTypeId,
    			TenantId:     exampleTenant.TenantId,
    			RoleId:       exampleDeviceRole.DeviceRoleId,
    			SiteId:       exampleSite.SiteId,
    		})
    		if err != nil {
    			return err
    		}
    		exampleInstalledDevice, err := netbox.NewDevice(ctx, "exampleInstalledDevice", &netbox.DeviceArgs{
    			DeviceTypeId: exampleInstalledDeviceType.DeviceTypeId,
    			TenantId:     exampleTenant.TenantId,
    			RoleId:       exampleDeviceRole.DeviceRoleId,
    			SiteId:       exampleSite.SiteId,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = netbox.NewDeviceBay(ctx, "exampleDeviceBay", &netbox.DeviceBayArgs{
    			DeviceId:          exampleDevice.DeviceId,
    			Label:             pulumi.String("example_label"),
    			Description:       pulumi.String("example_description"),
    			InstalledDeviceId: exampleInstalledDevice.DeviceId,
    		})
    		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 exampleTenant = new Netbox.Tenant("exampleTenant");
    
        var exampleSite = new Netbox.Site("exampleSite", new()
        {
            Status = "active",
        });
    
        var exampleManufacturer = new Netbox.Manufacturer("exampleManufacturer");
    
        var exampleDeviceType = new Netbox.DeviceType("exampleDeviceType", new()
        {
            Model = "example_device_type",
            ManufacturerId = exampleManufacturer.ManufacturerId,
            SubdeviceRole = "parent",
        });
    
        var exampleInstalledDeviceType = new Netbox.DeviceType("exampleInstalledDeviceType", new()
        {
            Model = "example_device_type_installed",
            ManufacturerId = exampleManufacturer.ManufacturerId,
            UHeight = 0,
            SubdeviceRole = "child",
        });
    
        var exampleDeviceRole = new Netbox.DeviceRole("exampleDeviceRole", new()
        {
            ColorHex = "123456",
        });
    
        var exampleDevice = new Netbox.Device("exampleDevice", new()
        {
            DeviceTypeId = exampleDeviceType.DeviceTypeId,
            TenantId = exampleTenant.TenantId,
            RoleId = exampleDeviceRole.DeviceRoleId,
            SiteId = exampleSite.SiteId,
        });
    
        var exampleInstalledDevice = new Netbox.Device("exampleInstalledDevice", new()
        {
            DeviceTypeId = exampleInstalledDeviceType.DeviceTypeId,
            TenantId = exampleTenant.TenantId,
            RoleId = exampleDeviceRole.DeviceRoleId,
            SiteId = exampleSite.SiteId,
        });
    
        var exampleDeviceBay = new Netbox.DeviceBay("exampleDeviceBay", new()
        {
            DeviceId = exampleDevice.DeviceId,
            Label = "example_label",
            Description = "example_description",
            InstalledDeviceId = exampleInstalledDevice.DeviceId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.Tenant;
    import com.pulumi.netbox.Site;
    import com.pulumi.netbox.SiteArgs;
    import com.pulumi.netbox.Manufacturer;
    import com.pulumi.netbox.DeviceType;
    import com.pulumi.netbox.DeviceTypeArgs;
    import com.pulumi.netbox.DeviceRole;
    import com.pulumi.netbox.DeviceRoleArgs;
    import com.pulumi.netbox.Device;
    import com.pulumi.netbox.DeviceArgs;
    import com.pulumi.netbox.DeviceBay;
    import com.pulumi.netbox.DeviceBayArgs;
    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 exampleTenant = new Tenant("exampleTenant");
    
            var exampleSite = new Site("exampleSite", SiteArgs.builder()
                .status("active")
                .build());
    
            var exampleManufacturer = new Manufacturer("exampleManufacturer");
    
            var exampleDeviceType = new DeviceType("exampleDeviceType", DeviceTypeArgs.builder()
                .model("example_device_type")
                .manufacturerId(exampleManufacturer.manufacturerId())
                .subdeviceRole("parent")
                .build());
    
            var exampleInstalledDeviceType = new DeviceType("exampleInstalledDeviceType", DeviceTypeArgs.builder()
                .model("example_device_type_installed")
                .manufacturerId(exampleManufacturer.manufacturerId())
                .uHeight(0)
                .subdeviceRole("child")
                .build());
    
            var exampleDeviceRole = new DeviceRole("exampleDeviceRole", DeviceRoleArgs.builder()
                .colorHex("123456")
                .build());
    
            var exampleDevice = new Device("exampleDevice", DeviceArgs.builder()
                .deviceTypeId(exampleDeviceType.deviceTypeId())
                .tenantId(exampleTenant.tenantId())
                .roleId(exampleDeviceRole.deviceRoleId())
                .siteId(exampleSite.siteId())
                .build());
    
            var exampleInstalledDevice = new Device("exampleInstalledDevice", DeviceArgs.builder()
                .deviceTypeId(exampleInstalledDeviceType.deviceTypeId())
                .tenantId(exampleTenant.tenantId())
                .roleId(exampleDeviceRole.deviceRoleId())
                .siteId(exampleSite.siteId())
                .build());
    
            var exampleDeviceBay = new DeviceBay("exampleDeviceBay", DeviceBayArgs.builder()
                .deviceId(exampleDevice.deviceId())
                .label("example_label")
                .description("example_description")
                .installedDeviceId(exampleInstalledDevice.deviceId())
                .build());
    
        }
    }
    
    resources:
      exampleTenant:
        type: netbox:Tenant
      exampleSite:
        type: netbox:Site
        properties:
          status: active
      exampleManufacturer:
        type: netbox:Manufacturer
      exampleDeviceType:
        type: netbox:DeviceType
        properties:
          model: example_device_type
          manufacturerId: ${exampleManufacturer.manufacturerId}
          subdeviceRole: parent
      exampleInstalledDeviceType:
        type: netbox:DeviceType
        properties:
          model: example_device_type_installed
          manufacturerId: ${exampleManufacturer.manufacturerId}
          uHeight: 0
          subdeviceRole: child
      exampleDeviceRole:
        type: netbox:DeviceRole
        properties:
          colorHex: '123456'
      exampleDevice:
        type: netbox:Device
        properties:
          deviceTypeId: ${exampleDeviceType.deviceTypeId}
          tenantId: ${exampleTenant.tenantId}
          roleId: ${exampleDeviceRole.deviceRoleId}
          siteId: ${exampleSite.siteId}
      exampleInstalledDevice:
        type: netbox:Device
        properties:
          deviceTypeId: ${exampleInstalledDeviceType.deviceTypeId}
          tenantId: ${exampleTenant.tenantId}
          roleId: ${exampleDeviceRole.deviceRoleId}
          siteId: ${exampleSite.siteId}
      exampleDeviceBay:
        type: netbox:DeviceBay
        properties:
          deviceId: ${exampleDevice.deviceId}
          label: example_label
          description: example_description
          installedDeviceId: ${exampleInstalledDevice.deviceId}
    

    Create DeviceBay Resource

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

    Constructor syntax

    new DeviceBay(name: string, args: DeviceBayArgs, opts?: CustomResourceOptions);
    @overload
    def DeviceBay(resource_name: str,
                  args: DeviceBayArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def DeviceBay(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  device_id: Optional[float] = None,
                  custom_fields: Optional[Mapping[str, str]] = None,
                  description: Optional[str] = None,
                  device_bay_id: Optional[str] = None,
                  installed_device_id: Optional[float] = None,
                  label: Optional[str] = None,
                  name: Optional[str] = None,
                  tags: Optional[Sequence[str]] = None)
    func NewDeviceBay(ctx *Context, name string, args DeviceBayArgs, opts ...ResourceOption) (*DeviceBay, error)
    public DeviceBay(string name, DeviceBayArgs args, CustomResourceOptions? opts = null)
    public DeviceBay(String name, DeviceBayArgs args)
    public DeviceBay(String name, DeviceBayArgs args, CustomResourceOptions options)
    
    type: netbox:DeviceBay
    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 DeviceBayArgs
    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 DeviceBayArgs
    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 DeviceBayArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DeviceBayArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DeviceBayArgs
    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 deviceBayResource = new Netbox.DeviceBay("deviceBayResource", new()
    {
        DeviceId = 0,
        CustomFields = 
        {
            { "string", "string" },
        },
        Description = "string",
        DeviceBayId = "string",
        InstalledDeviceId = 0,
        Label = "string",
        Name = "string",
        Tags = new[]
        {
            "string",
        },
    });
    
    example, err := netbox.NewDeviceBay(ctx, "deviceBayResource", &netbox.DeviceBayArgs{
    	DeviceId: pulumi.Float64(0),
    	CustomFields: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Description:       pulumi.String("string"),
    	DeviceBayId:       pulumi.String("string"),
    	InstalledDeviceId: pulumi.Float64(0),
    	Label:             pulumi.String("string"),
    	Name:              pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var deviceBayResource = new DeviceBay("deviceBayResource", DeviceBayArgs.builder()
        .deviceId(0.0)
        .customFields(Map.of("string", "string"))
        .description("string")
        .deviceBayId("string")
        .installedDeviceId(0.0)
        .label("string")
        .name("string")
        .tags("string")
        .build());
    
    device_bay_resource = netbox.DeviceBay("deviceBayResource",
        device_id=0,
        custom_fields={
            "string": "string",
        },
        description="string",
        device_bay_id="string",
        installed_device_id=0,
        label="string",
        name="string",
        tags=["string"])
    
    const deviceBayResource = new netbox.DeviceBay("deviceBayResource", {
        deviceId: 0,
        customFields: {
            string: "string",
        },
        description: "string",
        deviceBayId: "string",
        installedDeviceId: 0,
        label: "string",
        name: "string",
        tags: ["string"],
    });
    
    type: netbox:DeviceBay
    properties:
        customFields:
            string: string
        description: string
        deviceBayId: string
        deviceId: 0
        installedDeviceId: 0
        label: string
        name: string
        tags:
            - string
    

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

    DeviceId double
    CustomFields Dictionary<string, string>
    Description string
    DeviceBayId string
    The ID of this resource.
    InstalledDeviceId double
    Label string
    Name string
    Tags List<string>
    DeviceId float64
    CustomFields map[string]string
    Description string
    DeviceBayId string
    The ID of this resource.
    InstalledDeviceId float64
    Label string
    Name string
    Tags []string
    deviceId Double
    customFields Map<String,String>
    description String
    deviceBayId String
    The ID of this resource.
    installedDeviceId Double
    label String
    name String
    tags List<String>
    deviceId number
    customFields {[key: string]: string}
    description string
    deviceBayId string
    The ID of this resource.
    installedDeviceId number
    label string
    name string
    tags string[]
    device_id float
    custom_fields Mapping[str, str]
    description str
    device_bay_id str
    The ID of this resource.
    installed_device_id float
    label str
    name str
    tags Sequence[str]
    deviceId Number
    customFields Map<String>
    description String
    deviceBayId String
    The ID of this resource.
    installedDeviceId Number
    label String
    name String
    tags List<String>

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAlls List<string>
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAlls []string
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAlls List<String>
    id string
    The provider-assigned unique ID for this managed resource.
    tagsAlls string[]
    id str
    The provider-assigned unique ID for this managed resource.
    tags_alls Sequence[str]
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAlls List<String>

    Look up Existing DeviceBay Resource

    Get an existing DeviceBay 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?: DeviceBayState, opts?: CustomResourceOptions): DeviceBay
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            custom_fields: Optional[Mapping[str, str]] = None,
            description: Optional[str] = None,
            device_bay_id: Optional[str] = None,
            device_id: Optional[float] = None,
            installed_device_id: Optional[float] = None,
            label: Optional[str] = None,
            name: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            tags_alls: Optional[Sequence[str]] = None) -> DeviceBay
    func GetDeviceBay(ctx *Context, name string, id IDInput, state *DeviceBayState, opts ...ResourceOption) (*DeviceBay, error)
    public static DeviceBay Get(string name, Input<string> id, DeviceBayState? state, CustomResourceOptions? opts = null)
    public static DeviceBay get(String name, Output<String> id, DeviceBayState state, CustomResourceOptions options)
    resources:  _:    type: netbox:DeviceBay    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.
    The following state arguments are supported:
    CustomFields Dictionary<string, string>
    Description string
    DeviceBayId string
    The ID of this resource.
    DeviceId double
    InstalledDeviceId double
    Label string
    Name string
    Tags List<string>
    TagsAlls List<string>
    CustomFields map[string]string
    Description string
    DeviceBayId string
    The ID of this resource.
    DeviceId float64
    InstalledDeviceId float64
    Label string
    Name string
    Tags []string
    TagsAlls []string
    customFields Map<String,String>
    description String
    deviceBayId String
    The ID of this resource.
    deviceId Double
    installedDeviceId Double
    label String
    name String
    tags List<String>
    tagsAlls List<String>
    customFields {[key: string]: string}
    description string
    deviceBayId string
    The ID of this resource.
    deviceId number
    installedDeviceId number
    label string
    name string
    tags string[]
    tagsAlls string[]
    custom_fields Mapping[str, str]
    description str
    device_bay_id str
    The ID of this resource.
    device_id float
    installed_device_id float
    label str
    name str
    tags Sequence[str]
    tags_alls Sequence[str]
    customFields Map<String>
    description String
    deviceBayId String
    The ID of this resource.
    deviceId Number
    installedDeviceId Number
    label String
    name String
    tags List<String>
    tagsAlls List<String>

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 5.0.0 published on Friday, Sep 12, 2025 by e-breuninger