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

netbox.DeviceRearPort

Explore with Pulumi AI

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

    From the official documentation:

    Like front ports, rear ports are pass-through ports which represent the continuation of a path from one cable to the next. Each rear port is defined with its physical type and a number of positions: Rear ports with more than one position can be mapped to multiple front ports. This can be useful for modeling instances where multiple paths share a common cable (for example, six discrete two-strand fiber connections sharing a 12-strand MPO cable).

    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 testDeviceRearPort = new netbox.DeviceRearPort("testDeviceRearPort", {
        deviceId: testDevice.deviceId,
        type: "8p8c",
        positions: 2,
        markConnected: true,
    });
    
    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_rear_port = netbox.DeviceRearPort("testDeviceRearPort",
        device_id=test_device.device_id,
        type="8p8c",
        positions=2,
        mark_connected=True)
    
    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
    		}
    		_, err = netbox.NewDeviceRearPort(ctx, "testDeviceRearPort", &netbox.DeviceRearPortArgs{
    			DeviceId:      testDevice.DeviceId,
    			Type:          pulumi.String("8p8c"),
    			Positions:     pulumi.Float64(2),
    			MarkConnected: pulumi.Bool(true),
    		})
    		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 testDeviceRearPort = new Netbox.DeviceRearPort("testDeviceRearPort", new()
        {
            DeviceId = testDevice.DeviceId,
            Type = "8p8c",
            Positions = 2,
            MarkConnected = true,
        });
    
    });
    
    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.DeviceRearPort;
    import com.pulumi.netbox.DeviceRearPortArgs;
    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 testDeviceRearPort = new DeviceRearPort("testDeviceRearPort", DeviceRearPortArgs.builder()
                .deviceId(testDevice.deviceId())
                .type("8p8c")
                .positions(2)
                .markConnected(true)
                .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}
      testDeviceRearPort:
        type: netbox:DeviceRearPort
        properties:
          deviceId: ${testDevice.deviceId}
          type: 8p8c
          positions: 2
          markConnected: true
    

    Create DeviceRearPort Resource

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

    Constructor syntax

    new DeviceRearPort(name: string, args: DeviceRearPortArgs, opts?: CustomResourceOptions);
    @overload
    def DeviceRearPort(resource_name: str,
                       args: DeviceRearPortArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def DeviceRearPort(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       device_id: Optional[float] = None,
                       positions: Optional[float] = None,
                       type: Optional[str] = None,
                       color_hex: Optional[str] = None,
                       custom_fields: Optional[Mapping[str, str]] = None,
                       description: Optional[str] = None,
                       device_rear_port_id: Optional[str] = None,
                       label: Optional[str] = None,
                       mark_connected: Optional[bool] = None,
                       module_id: Optional[float] = None,
                       name: Optional[str] = None,
                       tags: Optional[Sequence[str]] = None)
    func NewDeviceRearPort(ctx *Context, name string, args DeviceRearPortArgs, opts ...ResourceOption) (*DeviceRearPort, error)
    public DeviceRearPort(string name, DeviceRearPortArgs args, CustomResourceOptions? opts = null)
    public DeviceRearPort(String name, DeviceRearPortArgs args)
    public DeviceRearPort(String name, DeviceRearPortArgs args, CustomResourceOptions options)
    
    type: netbox:DeviceRearPort
    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 DeviceRearPortArgs
    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 DeviceRearPortArgs
    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 DeviceRearPortArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DeviceRearPortArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DeviceRearPortArgs
    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 deviceRearPortResource = new Netbox.DeviceRearPort("deviceRearPortResource", new()
    {
        DeviceId = 0,
        Positions = 0,
        Type = "string",
        ColorHex = "string",
        CustomFields = 
        {
            { "string", "string" },
        },
        Description = "string",
        DeviceRearPortId = "string",
        Label = "string",
        MarkConnected = false,
        ModuleId = 0,
        Name = "string",
        Tags = new[]
        {
            "string",
        },
    });
    
    example, err := netbox.NewDeviceRearPort(ctx, "deviceRearPortResource", &netbox.DeviceRearPortArgs{
    	DeviceId:  pulumi.Float64(0),
    	Positions: pulumi.Float64(0),
    	Type:      pulumi.String("string"),
    	ColorHex:  pulumi.String("string"),
    	CustomFields: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Description:      pulumi.String("string"),
    	DeviceRearPortId: pulumi.String("string"),
    	Label:            pulumi.String("string"),
    	MarkConnected:    pulumi.Bool(false),
    	ModuleId:         pulumi.Float64(0),
    	Name:             pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var deviceRearPortResource = new DeviceRearPort("deviceRearPortResource", DeviceRearPortArgs.builder()
        .deviceId(0)
        .positions(0)
        .type("string")
        .colorHex("string")
        .customFields(Map.of("string", "string"))
        .description("string")
        .deviceRearPortId("string")
        .label("string")
        .markConnected(false)
        .moduleId(0)
        .name("string")
        .tags("string")
        .build());
    
    device_rear_port_resource = netbox.DeviceRearPort("deviceRearPortResource",
        device_id=0,
        positions=0,
        type="string",
        color_hex="string",
        custom_fields={
            "string": "string",
        },
        description="string",
        device_rear_port_id="string",
        label="string",
        mark_connected=False,
        module_id=0,
        name="string",
        tags=["string"])
    
    const deviceRearPortResource = new netbox.DeviceRearPort("deviceRearPortResource", {
        deviceId: 0,
        positions: 0,
        type: "string",
        colorHex: "string",
        customFields: {
            string: "string",
        },
        description: "string",
        deviceRearPortId: "string",
        label: "string",
        markConnected: false,
        moduleId: 0,
        name: "string",
        tags: ["string"],
    });
    
    type: netbox:DeviceRearPort
    properties:
        colorHex: string
        customFields:
            string: string
        description: string
        deviceId: 0
        deviceRearPortId: string
        label: string
        markConnected: false
        moduleId: 0
        name: string
        positions: 0
        tags:
            - string
        type: string
    

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

    DeviceId double
    Positions double
    Type string
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    ColorHex string
    CustomFields Dictionary<string, string>
    Description string
    DeviceRearPortId string
    The ID of this resource.
    Label string
    MarkConnected bool
    Defaults to false.
    ModuleId double
    Name string
    Tags List<string>
    DeviceId float64
    Positions float64
    Type string
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    ColorHex string
    CustomFields map[string]string
    Description string
    DeviceRearPortId string
    The ID of this resource.
    Label string
    MarkConnected bool
    Defaults to false.
    ModuleId float64
    Name string
    Tags []string
    deviceId Double
    positions Double
    type String
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    colorHex String
    customFields Map<String,String>
    description String
    deviceRearPortId String
    The ID of this resource.
    label String
    markConnected Boolean
    Defaults to false.
    moduleId Double
    name String
    tags List<String>
    deviceId number
    positions number
    type string
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    colorHex string
    customFields {[key: string]: string}
    description string
    deviceRearPortId string
    The ID of this resource.
    label string
    markConnected boolean
    Defaults to false.
    moduleId number
    name string
    tags string[]
    device_id float
    positions float
    type str
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    color_hex str
    custom_fields Mapping[str, str]
    description str
    device_rear_port_id str
    The ID of this resource.
    label str
    mark_connected bool
    Defaults to false.
    module_id float
    name str
    tags Sequence[str]
    deviceId Number
    positions Number
    type String
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    colorHex String
    customFields Map<String>
    description String
    deviceRearPortId String
    The ID of this resource.
    label String
    markConnected Boolean
    Defaults to false.
    moduleId Number
    name String
    tags List<String>

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DeviceRearPort 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 DeviceRearPort Resource

    Get an existing DeviceRearPort 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?: DeviceRearPortState, opts?: CustomResourceOptions): DeviceRearPort
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            color_hex: Optional[str] = None,
            custom_fields: Optional[Mapping[str, str]] = None,
            description: Optional[str] = None,
            device_id: Optional[float] = None,
            device_rear_port_id: Optional[str] = None,
            label: Optional[str] = None,
            mark_connected: Optional[bool] = None,
            module_id: Optional[float] = None,
            name: Optional[str] = None,
            positions: Optional[float] = None,
            tags: Optional[Sequence[str]] = None,
            type: Optional[str] = None) -> DeviceRearPort
    func GetDeviceRearPort(ctx *Context, name string, id IDInput, state *DeviceRearPortState, opts ...ResourceOption) (*DeviceRearPort, error)
    public static DeviceRearPort Get(string name, Input<string> id, DeviceRearPortState? state, CustomResourceOptions? opts = null)
    public static DeviceRearPort get(String name, Output<String> id, DeviceRearPortState state, CustomResourceOptions options)
    resources:  _:    type: netbox:DeviceRearPort    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:
    ColorHex string
    CustomFields Dictionary<string, string>
    Description string
    DeviceId double
    DeviceRearPortId string
    The ID of this resource.
    Label string
    MarkConnected bool
    Defaults to false.
    ModuleId double
    Name string
    Positions double
    Tags List<string>
    Type string
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    ColorHex string
    CustomFields map[string]string
    Description string
    DeviceId float64
    DeviceRearPortId string
    The ID of this resource.
    Label string
    MarkConnected bool
    Defaults to false.
    ModuleId float64
    Name string
    Positions float64
    Tags []string
    Type string
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    colorHex String
    customFields Map<String,String>
    description String
    deviceId Double
    deviceRearPortId String
    The ID of this resource.
    label String
    markConnected Boolean
    Defaults to false.
    moduleId Double
    name String
    positions Double
    tags List<String>
    type String
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    colorHex string
    customFields {[key: string]: string}
    description string
    deviceId number
    deviceRearPortId string
    The ID of this resource.
    label string
    markConnected boolean
    Defaults to false.
    moduleId number
    name string
    positions number
    tags string[]
    type string
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    color_hex str
    custom_fields Mapping[str, str]
    description str
    device_id float
    device_rear_port_id str
    The ID of this resource.
    label str
    mark_connected bool
    Defaults to false.
    module_id float
    name str
    positions float
    tags Sequence[str]
    type str
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].
    colorHex String
    customFields Map<String>
    description String
    deviceId Number
    deviceRearPortId String
    The ID of this resource.
    label String
    markConnected Boolean
    Defaults to false.
    moduleId Number
    name String
    positions Number
    tags List<String>
    type String
    One of [8p8c, 8p6c, 8p4c, 8p2c, 6p6c, 6p4c, 6p2c, 4p4c, 4p2c, gg45, tera-4p, tera-2p, tera-1p, 110-punch, bnc, f, n, mrj21, fc, lc, lc-pc, lc-upc, lc-apc, lsh, lsh-pc, lsh-upc, lsh-apc, mpo, mtrj, sc, sc-pc, sc-upc, sc-apc, st, cs, sn, sma-905, sma-906, urm-p2, urm-p4, urm-p8, splice, other].

    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