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 example = new netbox.Tenant("example", {name: "example_tenant"});
const exampleSite = new netbox.Site("example", {
name: "example_site",
status: "active",
});
const exampleManufacturer = new netbox.Manufacturer("example", {name: "example_manufacturer"});
const exampleDeviceType = new netbox.DeviceType("example", {
model: "example_device_type",
manufacturerId: exampleManufacturer.manufacturerId,
subdeviceRole: "parent",
});
const exampleInstalled = new netbox.DeviceType("example_installed", {
model: "example_device_type_installed",
manufacturerId: exampleManufacturer.manufacturerId,
uHeight: 0,
subdeviceRole: "child",
});
const exampleDeviceRole = new netbox.DeviceRole("example", {
name: "example_role",
colorHex: "123456",
});
const exampleDevice = new netbox.Device("example", {
name: "example_device",
deviceTypeId: exampleDeviceType.deviceTypeId,
tenantId: example.tenantId,
roleId: exampleDeviceRole.deviceRoleId,
siteId: exampleSite.siteId,
});
const exampleInstalledDevice = new netbox.Device("example_installed", {
name: "example_device_installed",
deviceTypeId: exampleInstalled.deviceTypeId,
tenantId: example.tenantId,
roleId: exampleDeviceRole.deviceRoleId,
siteId: exampleSite.siteId,
});
const exampleDeviceBay = new netbox.DeviceBay("example", {
deviceId: exampleDevice.deviceId,
name: "example_device_bay",
label: "example_label",
description: "example_description",
installedDeviceId: exampleInstalledDevice.deviceId,
});
import pulumi
import pulumi_netbox as netbox
example = netbox.Tenant("example", name="example_tenant")
example_site = netbox.Site("example",
name="example_site",
status="active")
example_manufacturer = netbox.Manufacturer("example", name="example_manufacturer")
example_device_type = netbox.DeviceType("example",
model="example_device_type",
manufacturer_id=example_manufacturer.manufacturer_id,
subdevice_role="parent")
example_installed = netbox.DeviceType("example_installed",
model="example_device_type_installed",
manufacturer_id=example_manufacturer.manufacturer_id,
u_height=0,
subdevice_role="child")
example_device_role = netbox.DeviceRole("example",
name="example_role",
color_hex="123456")
example_device = netbox.Device("example",
name="example_device",
device_type_id=example_device_type.device_type_id,
tenant_id=example.tenant_id,
role_id=example_device_role.device_role_id,
site_id=example_site.site_id)
example_installed_device = netbox.Device("example_installed",
name="example_device_installed",
device_type_id=example_installed.device_type_id,
tenant_id=example.tenant_id,
role_id=example_device_role.device_role_id,
site_id=example_site.site_id)
example_device_bay = netbox.DeviceBay("example",
device_id=example_device.device_id,
name="example_device_bay",
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 {
example, err := netbox.NewTenant(ctx, "example", &netbox.TenantArgs{
Name: pulumi.String("example_tenant"),
})
if err != nil {
return err
}
exampleSite, err := netbox.NewSite(ctx, "example", &netbox.SiteArgs{
Name: pulumi.String("example_site"),
Status: pulumi.String("active"),
})
if err != nil {
return err
}
exampleManufacturer, err := netbox.NewManufacturer(ctx, "example", &netbox.ManufacturerArgs{
Name: pulumi.String("example_manufacturer"),
})
if err != nil {
return err
}
exampleDeviceType, err := netbox.NewDeviceType(ctx, "example", &netbox.DeviceTypeArgs{
Model: pulumi.String("example_device_type"),
ManufacturerId: exampleManufacturer.ManufacturerId,
SubdeviceRole: pulumi.String("parent"),
})
if err != nil {
return err
}
exampleInstalled, err := netbox.NewDeviceType(ctx, "example_installed", &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, "example", &netbox.DeviceRoleArgs{
Name: pulumi.String("example_role"),
ColorHex: pulumi.String("123456"),
})
if err != nil {
return err
}
exampleDevice, err := netbox.NewDevice(ctx, "example", &netbox.DeviceArgs{
Name: pulumi.String("example_device"),
DeviceTypeId: exampleDeviceType.DeviceTypeId,
TenantId: example.TenantId,
RoleId: exampleDeviceRole.DeviceRoleId,
SiteId: exampleSite.SiteId,
})
if err != nil {
return err
}
exampleInstalledDevice, err := netbox.NewDevice(ctx, "example_installed", &netbox.DeviceArgs{
Name: pulumi.String("example_device_installed"),
DeviceTypeId: exampleInstalled.DeviceTypeId,
TenantId: example.TenantId,
RoleId: exampleDeviceRole.DeviceRoleId,
SiteId: exampleSite.SiteId,
})
if err != nil {
return err
}
_, err = netbox.NewDeviceBay(ctx, "example", &netbox.DeviceBayArgs{
DeviceId: exampleDevice.DeviceId,
Name: pulumi.String("example_device_bay"),
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 example = new Netbox.Tenant("example", new()
{
Name = "example_tenant",
});
var exampleSite = new Netbox.Site("example", new()
{
Name = "example_site",
Status = "active",
});
var exampleManufacturer = new Netbox.Manufacturer("example", new()
{
Name = "example_manufacturer",
});
var exampleDeviceType = new Netbox.DeviceType("example", new()
{
Model = "example_device_type",
ManufacturerId = exampleManufacturer.ManufacturerId,
SubdeviceRole = "parent",
});
var exampleInstalled = new Netbox.DeviceType("example_installed", new()
{
Model = "example_device_type_installed",
ManufacturerId = exampleManufacturer.ManufacturerId,
UHeight = 0,
SubdeviceRole = "child",
});
var exampleDeviceRole = new Netbox.DeviceRole("example", new()
{
Name = "example_role",
ColorHex = "123456",
});
var exampleDevice = new Netbox.Device("example", new()
{
Name = "example_device",
DeviceTypeId = exampleDeviceType.DeviceTypeId,
TenantId = example.TenantId,
RoleId = exampleDeviceRole.DeviceRoleId,
SiteId = exampleSite.SiteId,
});
var exampleInstalledDevice = new Netbox.Device("example_installed", new()
{
Name = "example_device_installed",
DeviceTypeId = exampleInstalled.DeviceTypeId,
TenantId = example.TenantId,
RoleId = exampleDeviceRole.DeviceRoleId,
SiteId = exampleSite.SiteId,
});
var exampleDeviceBay = new Netbox.DeviceBay("example", new()
{
DeviceId = exampleDevice.DeviceId,
Name = "example_device_bay",
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.TenantArgs;
import com.pulumi.netbox.Site;
import com.pulumi.netbox.SiteArgs;
import com.pulumi.netbox.Manufacturer;
import com.pulumi.netbox.ManufacturerArgs;
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 example = new Tenant("example", TenantArgs.builder()
.name("example_tenant")
.build());
var exampleSite = new Site("exampleSite", SiteArgs.builder()
.name("example_site")
.status("active")
.build());
var exampleManufacturer = new Manufacturer("exampleManufacturer", ManufacturerArgs.builder()
.name("example_manufacturer")
.build());
var exampleDeviceType = new DeviceType("exampleDeviceType", DeviceTypeArgs.builder()
.model("example_device_type")
.manufacturerId(exampleManufacturer.manufacturerId())
.subdeviceRole("parent")
.build());
var exampleInstalled = new DeviceType("exampleInstalled", DeviceTypeArgs.builder()
.model("example_device_type_installed")
.manufacturerId(exampleManufacturer.manufacturerId())
.uHeight(0.0)
.subdeviceRole("child")
.build());
var exampleDeviceRole = new DeviceRole("exampleDeviceRole", DeviceRoleArgs.builder()
.name("example_role")
.colorHex("123456")
.build());
var exampleDevice = new Device("exampleDevice", DeviceArgs.builder()
.name("example_device")
.deviceTypeId(exampleDeviceType.deviceTypeId())
.tenantId(example.tenantId())
.roleId(exampleDeviceRole.deviceRoleId())
.siteId(exampleSite.siteId())
.build());
var exampleInstalledDevice = new Device("exampleInstalledDevice", DeviceArgs.builder()
.name("example_device_installed")
.deviceTypeId(exampleInstalled.deviceTypeId())
.tenantId(example.tenantId())
.roleId(exampleDeviceRole.deviceRoleId())
.siteId(exampleSite.siteId())
.build());
var exampleDeviceBay = new DeviceBay("exampleDeviceBay", DeviceBayArgs.builder()
.deviceId(exampleDevice.deviceId())
.name("example_device_bay")
.label("example_label")
.description("example_description")
.installedDeviceId(exampleInstalledDevice.deviceId())
.build());
}
}
resources:
example:
type: netbox:Tenant
properties:
name: example_tenant
exampleSite:
type: netbox:Site
name: example
properties:
name: example_site
status: active
exampleManufacturer:
type: netbox:Manufacturer
name: example
properties:
name: example_manufacturer
exampleDeviceType:
type: netbox:DeviceType
name: example
properties:
model: example_device_type
manufacturerId: ${exampleManufacturer.manufacturerId}
subdeviceRole: parent
exampleInstalled:
type: netbox:DeviceType
name: example_installed
properties:
model: example_device_type_installed
manufacturerId: ${exampleManufacturer.manufacturerId}
uHeight: 0
subdeviceRole: child
exampleDeviceRole:
type: netbox:DeviceRole
name: example
properties:
name: example_role
colorHex: '123456'
exampleDevice:
type: netbox:Device
name: example
properties:
name: example_device
deviceTypeId: ${exampleDeviceType.deviceTypeId}
tenantId: ${example.tenantId}
roleId: ${exampleDeviceRole.deviceRoleId}
siteId: ${exampleSite.siteId}
exampleInstalledDevice:
type: netbox:Device
name: example_installed
properties:
name: example_device_installed
deviceTypeId: ${exampleInstalled.deviceTypeId}
tenantId: ${example.tenantId}
roleId: ${exampleDeviceRole.deviceRoleId}
siteId: ${exampleSite.siteId}
exampleDeviceBay:
type: netbox:DeviceBay
name: example
properties:
deviceId: ${exampleDevice.deviceId}
name: example_device_bay
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:
- Device
Id double - Custom
Fields Dictionary<string, string> - Description string
- Device
Bay stringId - The ID of this resource.
- Installed
Device doubleId - Label string
- Name string
- List<string>
- Device
Id float64 - Custom
Fields map[string]string - Description string
- Device
Bay stringId - The ID of this resource.
- Installed
Device float64Id - Label string
- Name string
- []string
- device
Id Double - custom
Fields Map<String,String> - description String
- device
Bay StringId - The ID of this resource.
- installed
Device DoubleId - label String
- name String
- List<String>
- device
Id number - custom
Fields {[key: string]: string} - description string
- device
Bay stringId - The ID of this resource.
- installed
Device numberId - label string
- name string
- string[]
- device_
id float - custom_
fields Mapping[str, str] - description str
- device_
bay_ strid - The ID of this resource.
- installed_
device_ floatid - label str
- name str
- Sequence[str]
- device
Id Number - custom
Fields Map<String> - description String
- device
Bay StringId - The ID of this resource.
- installed
Device NumberId - label String
- name String
- 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.
- List<string>
- Id string
- The provider-assigned unique ID for this managed resource.
- []string
- id String
- The provider-assigned unique ID for this managed resource.
- List<String>
- id string
- The provider-assigned unique ID for this managed resource.
- string[]
- id str
- The provider-assigned unique ID for this managed resource.
- Sequence[str]
- id String
- The provider-assigned unique ID for this managed resource.
- 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) -> DeviceBayfunc 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.
- Custom
Fields Dictionary<string, string> - Description string
- Device
Bay stringId - The ID of this resource.
- Device
Id double - Installed
Device doubleId - Label string
- Name string
- List<string>
- List<string>
- Custom
Fields map[string]string - Description string
- Device
Bay stringId - The ID of this resource.
- Device
Id float64 - Installed
Device float64Id - Label string
- Name string
- []string
- []string
- custom
Fields Map<String,String> - description String
- device
Bay StringId - The ID of this resource.
- device
Id Double - installed
Device DoubleId - label String
- name String
- List<String>
- List<String>
- custom
Fields {[key: string]: string} - description string
- device
Bay stringId - The ID of this resource.
- device
Id number - installed
Device numberId - label string
- name string
- string[]
- string[]
- custom_
fields Mapping[str, str] - description str
- device_
bay_ strid - The ID of this resource.
- device_
id float - installed_
device_ floatid - label str
- name str
- Sequence[str]
- Sequence[str]
- custom
Fields Map<String> - description String
- device
Bay StringId - The ID of this resource.
- device
Id Number - installed
Device NumberId - label String
- name String
- List<String>
- List<String>
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netboxTerraform Provider.
