netbox.Module
Explore with Pulumi AI
From the official documentation:
A module is a field-replaceable hardware component installed within a device which houses its own child components. The most common example is a chassis-based router or switch.
Similar to devices, modules are instantiated from module types, and any components associated with the module type are automatically instantiated on the new model. Each module must be installed within a module bay on a device, and each module bay may have only one module installed in it.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
// Note that some terraform code is not included in the example for brevity
const testDevice = new netbox.Device("testDevice", {
deviceTypeId: netbox_device_type.test.id,
roleId: netbox_device_role.test.id,
siteId: netbox_site.test.id,
});
const testDeviceModuleBay = new netbox.DeviceModuleBay("testDeviceModuleBay", {deviceId: testDevice.deviceId});
const testManufacturer = new netbox.Manufacturer("testManufacturer", {});
const testModuleType = new netbox.ModuleType("testModuleType", {
manufacturerId: testManufacturer.manufacturerId,
model: "Networking",
});
const testModule = new netbox.Module("testModule", {
deviceId: testDevice.deviceId,
moduleBayId: testDeviceModuleBay.deviceModuleBayId,
moduleTypeId: testModuleType.moduleTypeId,
status: "active",
description: "SFP card",
});
import pulumi
import pulumi_netbox as netbox
# Note that some terraform code is not included in the example for brevity
test_device = netbox.Device("testDevice",
device_type_id=netbox_device_type["test"]["id"],
role_id=netbox_device_role["test"]["id"],
site_id=netbox_site["test"]["id"])
test_device_module_bay = netbox.DeviceModuleBay("testDeviceModuleBay", device_id=test_device.device_id)
test_manufacturer = netbox.Manufacturer("testManufacturer")
test_module_type = netbox.ModuleType("testModuleType",
manufacturer_id=test_manufacturer.manufacturer_id,
model="Networking")
test_module = netbox.Module("testModule",
device_id=test_device.device_id,
module_bay_id=test_device_module_bay.device_module_bay_id,
module_type_id=test_module_type.module_type_id,
status="active",
description="SFP card")
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 {
// Note that some terraform code is not included in the example for brevity
testDevice, err := netbox.NewDevice(ctx, "testDevice", &netbox.DeviceArgs{
DeviceTypeId: pulumi.Any(netbox_device_type.Test.Id),
RoleId: pulumi.Any(netbox_device_role.Test.Id),
SiteId: pulumi.Any(netbox_site.Test.Id),
})
if err != nil {
return err
}
testDeviceModuleBay, err := netbox.NewDeviceModuleBay(ctx, "testDeviceModuleBay", &netbox.DeviceModuleBayArgs{
DeviceId: testDevice.DeviceId,
})
if err != nil {
return err
}
testManufacturer, err := netbox.NewManufacturer(ctx, "testManufacturer", nil)
if err != nil {
return err
}
testModuleType, err := netbox.NewModuleType(ctx, "testModuleType", &netbox.ModuleTypeArgs{
ManufacturerId: testManufacturer.ManufacturerId,
Model: pulumi.String("Networking"),
})
if err != nil {
return err
}
_, err = netbox.NewModule(ctx, "testModule", &netbox.ModuleArgs{
DeviceId: testDevice.DeviceId,
ModuleBayId: testDeviceModuleBay.DeviceModuleBayId,
ModuleTypeId: testModuleType.ModuleTypeId,
Status: pulumi.String("active"),
Description: pulumi.String("SFP card"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;
return await Deployment.RunAsync(() =>
{
// Note that some terraform code is not included in the example for brevity
var testDevice = new Netbox.Device("testDevice", new()
{
DeviceTypeId = netbox_device_type.Test.Id,
RoleId = netbox_device_role.Test.Id,
SiteId = netbox_site.Test.Id,
});
var testDeviceModuleBay = new Netbox.DeviceModuleBay("testDeviceModuleBay", new()
{
DeviceId = testDevice.DeviceId,
});
var testManufacturer = new Netbox.Manufacturer("testManufacturer");
var testModuleType = new Netbox.ModuleType("testModuleType", new()
{
ManufacturerId = testManufacturer.ManufacturerId,
Model = "Networking",
});
var testModule = new Netbox.Module("testModule", new()
{
DeviceId = testDevice.DeviceId,
ModuleBayId = testDeviceModuleBay.DeviceModuleBayId,
ModuleTypeId = testModuleType.ModuleTypeId,
Status = "active",
Description = "SFP card",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.Device;
import com.pulumi.netbox.DeviceArgs;
import com.pulumi.netbox.DeviceModuleBay;
import com.pulumi.netbox.DeviceModuleBayArgs;
import com.pulumi.netbox.Manufacturer;
import com.pulumi.netbox.ModuleType;
import com.pulumi.netbox.ModuleTypeArgs;
import com.pulumi.netbox.Module;
import com.pulumi.netbox.ModuleArgs;
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) {
// Note that some terraform code is not included in the example for brevity
var testDevice = new Device("testDevice", DeviceArgs.builder()
.deviceTypeId(netbox_device_type.test().id())
.roleId(netbox_device_role.test().id())
.siteId(netbox_site.test().id())
.build());
var testDeviceModuleBay = new DeviceModuleBay("testDeviceModuleBay", DeviceModuleBayArgs.builder()
.deviceId(testDevice.deviceId())
.build());
var testManufacturer = new Manufacturer("testManufacturer");
var testModuleType = new ModuleType("testModuleType", ModuleTypeArgs.builder()
.manufacturerId(testManufacturer.manufacturerId())
.model("Networking")
.build());
var testModule = new Module("testModule", ModuleArgs.builder()
.deviceId(testDevice.deviceId())
.moduleBayId(testDeviceModuleBay.deviceModuleBayId())
.moduleTypeId(testModuleType.moduleTypeId())
.status("active")
.description("SFP card")
.build());
}
}
resources:
# Note that some terraform code is not included in the example for brevity
testDevice:
type: netbox:Device
properties:
deviceTypeId: ${netbox_device_type.test.id}
roleId: ${netbox_device_role.test.id}
siteId: ${netbox_site.test.id}
testDeviceModuleBay:
type: netbox:DeviceModuleBay
properties:
deviceId: ${testDevice.deviceId}
testManufacturer:
type: netbox:Manufacturer
testModuleType:
type: netbox:ModuleType
properties:
manufacturerId: ${testManufacturer.manufacturerId}
model: Networking
testModule:
type: netbox:Module
properties:
deviceId: ${testDevice.deviceId}
moduleBayId: ${testDeviceModuleBay.deviceModuleBayId}
moduleTypeId: ${testModuleType.moduleTypeId}
status: active
description: SFP card
Create Module Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Module(name: string, args: ModuleArgs, opts?: CustomResourceOptions);
@overload
def Module(resource_name: str,
args: ModuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Module(resource_name: str,
opts: Optional[ResourceOptions] = None,
device_id: Optional[float] = None,
module_bay_id: Optional[float] = None,
module_type_id: Optional[float] = None,
status: Optional[str] = None,
asset_tag: Optional[str] = None,
comments: Optional[str] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
module_id: Optional[str] = None,
serial: Optional[str] = None,
tags: Optional[Sequence[str]] = None)
func NewModule(ctx *Context, name string, args ModuleArgs, opts ...ResourceOption) (*Module, error)
public Module(string name, ModuleArgs args, CustomResourceOptions? opts = null)
public Module(String name, ModuleArgs args)
public Module(String name, ModuleArgs args, CustomResourceOptions options)
type: netbox:Module
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 ModuleArgs
- 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 ModuleArgs
- 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 ModuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ModuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ModuleArgs
- 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 moduleResource = new Netbox.Module("moduleResource", new()
{
DeviceId = 0,
ModuleBayId = 0,
ModuleTypeId = 0,
Status = "string",
AssetTag = "string",
Comments = "string",
CustomFields =
{
{ "string", "string" },
},
Description = "string",
ModuleId = "string",
Serial = "string",
Tags = new[]
{
"string",
},
});
example, err := netbox.NewModule(ctx, "moduleResource", &netbox.ModuleArgs{
DeviceId: pulumi.Float64(0),
ModuleBayId: pulumi.Float64(0),
ModuleTypeId: pulumi.Float64(0),
Status: pulumi.String("string"),
AssetTag: pulumi.String("string"),
Comments: pulumi.String("string"),
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
Description: pulumi.String("string"),
ModuleId: pulumi.String("string"),
Serial: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
})
var moduleResource = new Module("moduleResource", ModuleArgs.builder()
.deviceId(0)
.moduleBayId(0)
.moduleTypeId(0)
.status("string")
.assetTag("string")
.comments("string")
.customFields(Map.of("string", "string"))
.description("string")
.moduleId("string")
.serial("string")
.tags("string")
.build());
module_resource = netbox.Module("moduleResource",
device_id=0,
module_bay_id=0,
module_type_id=0,
status="string",
asset_tag="string",
comments="string",
custom_fields={
"string": "string",
},
description="string",
module_id="string",
serial="string",
tags=["string"])
const moduleResource = new netbox.Module("moduleResource", {
deviceId: 0,
moduleBayId: 0,
moduleTypeId: 0,
status: "string",
assetTag: "string",
comments: "string",
customFields: {
string: "string",
},
description: "string",
moduleId: "string",
serial: "string",
tags: ["string"],
});
type: netbox:Module
properties:
assetTag: string
comments: string
customFields:
string: string
description: string
deviceId: 0
moduleBayId: 0
moduleId: string
moduleTypeId: 0
serial: string
status: string
tags:
- string
Module 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 Module resource accepts the following input properties:
- Device
Id double - Module
Bay doubleId - Module
Type doubleId - Status string
- One of [offline, active, planned, staged, failed, decommissioning].
- Asset
Tag string - Comments string
- Custom
Fields Dictionary<string, string> - Description string
- Module
Id string - The ID of this resource.
- Serial string
- List<string>
- Device
Id float64 - Module
Bay float64Id - Module
Type float64Id - Status string
- One of [offline, active, planned, staged, failed, decommissioning].
- Asset
Tag string - Comments string
- Custom
Fields map[string]string - Description string
- Module
Id string - The ID of this resource.
- Serial string
- []string
- device
Id Double - module
Bay DoubleId - module
Type DoubleId - status String
- One of [offline, active, planned, staged, failed, decommissioning].
- asset
Tag String - comments String
- custom
Fields Map<String,String> - description String
- module
Id String - The ID of this resource.
- serial String
- List<String>
- device
Id number - module
Bay numberId - module
Type numberId - status string
- One of [offline, active, planned, staged, failed, decommissioning].
- asset
Tag string - comments string
- custom
Fields {[key: string]: string} - description string
- module
Id string - The ID of this resource.
- serial string
- string[]
- device_
id float - module_
bay_ floatid - module_
type_ floatid - status str
- One of [offline, active, planned, staged, failed, decommissioning].
- asset_
tag str - comments str
- custom_
fields Mapping[str, str] - description str
- module_
id str - The ID of this resource.
- serial str
- Sequence[str]
- device
Id Number - module
Bay NumberId - module
Type NumberId - status String
- One of [offline, active, planned, staged, failed, decommissioning].
- asset
Tag String - comments String
- custom
Fields Map<String> - description String
- module
Id String - The ID of this resource.
- serial String
- List<String>
Outputs
All input properties are implicitly available as output properties. Additionally, the Module 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 Module Resource
Get an existing Module 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?: ModuleState, opts?: CustomResourceOptions): Module
@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,
description: Optional[str] = None,
device_id: Optional[float] = None,
module_bay_id: Optional[float] = None,
module_id: Optional[str] = None,
module_type_id: Optional[float] = None,
serial: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Sequence[str]] = None) -> Module
func GetModule(ctx *Context, name string, id IDInput, state *ModuleState, opts ...ResourceOption) (*Module, error)
public static Module Get(string name, Input<string> id, ModuleState? state, CustomResourceOptions? opts = null)
public static Module get(String name, Output<String> id, ModuleState state, CustomResourceOptions options)
resources: _: type: netbox:Module 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.
- Asset
Tag string - Comments string
- Custom
Fields Dictionary<string, string> - Description string
- Device
Id double - Module
Bay doubleId - Module
Id string - The ID of this resource.
- Module
Type doubleId - Serial string
- Status string
- One of [offline, active, planned, staged, failed, decommissioning].
- List<string>
- Asset
Tag string - Comments string
- Custom
Fields map[string]string - Description string
- Device
Id float64 - Module
Bay float64Id - Module
Id string - The ID of this resource.
- Module
Type float64Id - Serial string
- Status string
- One of [offline, active, planned, staged, failed, decommissioning].
- []string
- asset
Tag String - comments String
- custom
Fields Map<String,String> - description String
- device
Id Double - module
Bay DoubleId - module
Id String - The ID of this resource.
- module
Type DoubleId - serial String
- status String
- One of [offline, active, planned, staged, failed, decommissioning].
- List<String>
- asset
Tag string - comments string
- custom
Fields {[key: string]: string} - description string
- device
Id number - module
Bay numberId - module
Id string - The ID of this resource.
- module
Type numberId - serial string
- status string
- One of [offline, active, planned, staged, failed, decommissioning].
- string[]
- asset_
tag str - comments str
- custom_
fields Mapping[str, str] - description str
- device_
id float - module_
bay_ floatid - module_
id str - The ID of this resource.
- module_
type_ floatid - serial str
- status str
- One of [offline, active, planned, staged, failed, decommissioning].
- Sequence[str]
- asset
Tag String - comments String
- custom
Fields Map<String> - description String
- device
Id Number - module
Bay NumberId - module
Id String - The ID of this resource.
- module
Type NumberId - serial String
- status String
- One of [offline, active, planned, staged, failed, decommissioning].
- List<String>
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.