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

netbox.Module

Explore with Pulumi AI

netbox logo
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

    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:

    DeviceId double
    ModuleBayId double
    ModuleTypeId double
    Status string
    One of [offline, active, planned, staged, failed, decommissioning].
    AssetTag string
    Comments string
    CustomFields Dictionary<string, string>
    Description string
    ModuleId string
    The ID of this resource.
    Serial string
    Tags List<string>
    DeviceId float64
    ModuleBayId float64
    ModuleTypeId float64
    Status string
    One of [offline, active, planned, staged, failed, decommissioning].
    AssetTag string
    Comments string
    CustomFields map[string]string
    Description string
    ModuleId string
    The ID of this resource.
    Serial string
    Tags []string
    deviceId Double
    moduleBayId Double
    moduleTypeId Double
    status String
    One of [offline, active, planned, staged, failed, decommissioning].
    assetTag String
    comments String
    customFields Map<String,String>
    description String
    moduleId String
    The ID of this resource.
    serial String
    tags List<String>
    deviceId number
    moduleBayId number
    moduleTypeId number
    status string
    One of [offline, active, planned, staged, failed, decommissioning].
    assetTag string
    comments string
    customFields {[key: string]: string}
    description string
    moduleId string
    The ID of this resource.
    serial string
    tags string[]
    device_id float
    module_bay_id float
    module_type_id float
    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
    tags Sequence[str]
    deviceId Number
    moduleBayId Number
    moduleTypeId Number
    status String
    One of [offline, active, planned, staged, failed, decommissioning].
    assetTag String
    comments String
    customFields Map<String>
    description String
    moduleId String
    The ID of this resource.
    serial String
    tags 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.
    The following state arguments are supported:
    AssetTag string
    Comments string
    CustomFields Dictionary<string, string>
    Description string
    DeviceId double
    ModuleBayId double
    ModuleId string
    The ID of this resource.
    ModuleTypeId double
    Serial string
    Status string
    One of [offline, active, planned, staged, failed, decommissioning].
    Tags List<string>
    AssetTag string
    Comments string
    CustomFields map[string]string
    Description string
    DeviceId float64
    ModuleBayId float64
    ModuleId string
    The ID of this resource.
    ModuleTypeId float64
    Serial string
    Status string
    One of [offline, active, planned, staged, failed, decommissioning].
    Tags []string
    assetTag String
    comments String
    customFields Map<String,String>
    description String
    deviceId Double
    moduleBayId Double
    moduleId String
    The ID of this resource.
    moduleTypeId Double
    serial String
    status String
    One of [offline, active, planned, staged, failed, decommissioning].
    tags List<String>
    assetTag string
    comments string
    customFields {[key: string]: string}
    description string
    deviceId number
    moduleBayId number
    moduleId string
    The ID of this resource.
    moduleTypeId number
    serial string
    status string
    One of [offline, active, planned, staged, failed, decommissioning].
    tags string[]
    asset_tag str
    comments str
    custom_fields Mapping[str, str]
    description str
    device_id float
    module_bay_id float
    module_id str
    The ID of this resource.
    module_type_id float
    serial str
    status str
    One of [offline, active, planned, staged, failed, decommissioning].
    tags Sequence[str]
    assetTag String
    comments String
    customFields Map<String>
    description String
    deviceId Number
    moduleBayId Number
    moduleId String
    The ID of this resource.
    moduleTypeId Number
    serial String
    status String
    One of [offline, active, planned, staged, failed, decommissioning].
    tags 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 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger