1. Registry
  2. Packages
  3. Netbox Provider
  4. API Docs
  5. DeviceInterfacePrimaryMacAddress
Viewing docs for netbox 6.0.1
published on Monday, Nov 16, 2026 by e-breuninger
netbox
Viewing docs for netbox 6.0.1
published on Monday, Nov 16, 2026 by e-breuninger

    Sets the primary MAC address of a device interface. The address must be assigned to that interface (netbox_mac_address with device_interface_id). Import with the interface id.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const test = new netbox.Site("test", {name: "test-site"});
    const testManufacturer = new netbox.Manufacturer("test", {name: "test-manufacturer"});
    const testDeviceType = new netbox.DeviceType("test", {
        manufacturerId: testManufacturer.manufacturerId,
        model: "test-device-type",
    });
    const testDeviceRole = new netbox.DeviceRole("test", {name: "test-device-role"});
    const testDevice = new netbox.Device("test", {
        name: "test-device",
        deviceTypeId: testDeviceType.deviceTypeId,
        roleId: testDeviceRole.deviceRoleId,
        siteId: test.siteId,
    });
    const testDeviceInterface = new netbox.DeviceInterface("test", {
        deviceId: testDevice.deviceId,
        name: "test-interface",
        type: "1000base-t",
    });
    const testMacAddress = new netbox.MacAddress("test", {
        macAddress: "00:11:22:33:44:55",
        deviceInterfaceId: testDeviceInterface.deviceInterfaceId,
    });
    const testDeviceInterfacePrimaryMacAddress = new netbox.DeviceInterfacePrimaryMacAddress("test", {
        deviceInterfaceId: testDeviceInterface.deviceInterfaceId,
        macAddressId: testMacAddress.macAddressId,
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    test = netbox.Site("test", name="test-site")
    test_manufacturer = netbox.Manufacturer("test", name="test-manufacturer")
    test_device_type = netbox.DeviceType("test",
        manufacturer_id=test_manufacturer.manufacturer_id,
        model="test-device-type")
    test_device_role = netbox.DeviceRole("test", name="test-device-role")
    test_device = netbox.Device("test",
        name="test-device",
        device_type_id=test_device_type.device_type_id,
        role_id=test_device_role.device_role_id,
        site_id=test.site_id)
    test_device_interface = netbox.DeviceInterface("test",
        device_id=test_device.device_id,
        name="test-interface",
        type="1000base-t")
    test_mac_address = netbox.MacAddress("test",
        mac_address="00:11:22:33:44:55",
        device_interface_id=test_device_interface.device_interface_id)
    test_device_interface_primary_mac_address = netbox.DeviceInterfacePrimaryMacAddress("test",
        device_interface_id=test_device_interface.device_interface_id,
        mac_address_id=test_mac_address.mac_address_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v6/netbox"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := netbox.NewSite(ctx, "test", &netbox.SiteArgs{
    			Name: pulumi.String("test-site"),
    		})
    		if err != nil {
    			return err
    		}
    		testManufacturer, err := netbox.NewManufacturer(ctx, "test", &netbox.ManufacturerArgs{
    			Name: pulumi.String("test-manufacturer"),
    		})
    		if err != nil {
    			return err
    		}
    		testDeviceType, err := netbox.NewDeviceType(ctx, "test", &netbox.DeviceTypeArgs{
    			ManufacturerId: testManufacturer.ManufacturerId,
    			Model:          pulumi.String("test-device-type"),
    		})
    		if err != nil {
    			return err
    		}
    		testDeviceRole, err := netbox.NewDeviceRole(ctx, "test", &netbox.DeviceRoleArgs{
    			Name: pulumi.String("test-device-role"),
    		})
    		if err != nil {
    			return err
    		}
    		testDevice, err := netbox.NewDevice(ctx, "test", &netbox.DeviceArgs{
    			Name:         pulumi.String("test-device"),
    			DeviceTypeId: testDeviceType.DeviceTypeId,
    			RoleId:       testDeviceRole.DeviceRoleId,
    			SiteId:       test.SiteId,
    		})
    		if err != nil {
    			return err
    		}
    		testDeviceInterface, err := netbox.NewDeviceInterface(ctx, "test", &netbox.DeviceInterfaceArgs{
    			DeviceId: testDevice.DeviceId,
    			Name:     pulumi.String("test-interface"),
    			Type:     pulumi.String("1000base-t"),
    		})
    		if err != nil {
    			return err
    		}
    		testMacAddress, err := netbox.NewMacAddress(ctx, "test", &netbox.MacAddressArgs{
    			MacAddress:        pulumi.String("00:11:22:33:44:55"),
    			DeviceInterfaceId: testDeviceInterface.DeviceInterfaceId,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = netbox.NewDeviceInterfacePrimaryMacAddress(ctx, "test", &netbox.DeviceInterfacePrimaryMacAddressArgs{
    			DeviceInterfaceId: testDeviceInterface.DeviceInterfaceId,
    			MacAddressId:      testMacAddress.MacAddressId,
    		})
    		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 test = new Netbox.Site("test", new()
        {
            Name = "test-site",
        });
    
        var testManufacturer = new Netbox.Manufacturer("test", new()
        {
            Name = "test-manufacturer",
        });
    
        var testDeviceType = new Netbox.DeviceType("test", new()
        {
            ManufacturerId = testManufacturer.ManufacturerId,
            Model = "test-device-type",
        });
    
        var testDeviceRole = new Netbox.DeviceRole("test", new()
        {
            Name = "test-device-role",
        });
    
        var testDevice = new Netbox.Device("test", new()
        {
            Name = "test-device",
            DeviceTypeId = testDeviceType.DeviceTypeId,
            RoleId = testDeviceRole.DeviceRoleId,
            SiteId = test.SiteId,
        });
    
        var testDeviceInterface = new Netbox.DeviceInterface("test", new()
        {
            DeviceId = testDevice.DeviceId,
            Name = "test-interface",
            Type = "1000base-t",
        });
    
        var testMacAddress = new Netbox.MacAddress("test", new()
        {
            MacAddress = "00:11:22:33:44:55",
            DeviceInterfaceId = testDeviceInterface.DeviceInterfaceId,
        });
    
        var testDeviceInterfacePrimaryMacAddress = new Netbox.DeviceInterfacePrimaryMacAddress("test", new()
        {
            DeviceInterfaceId = testDeviceInterface.DeviceInterfaceId,
            MacAddressId = testMacAddress.MacAddressId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    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.DeviceInterface;
    import com.pulumi.netbox.DeviceInterfaceArgs;
    import com.pulumi.netbox.MacAddress;
    import com.pulumi.netbox.MacAddressArgs;
    import com.pulumi.netbox.DeviceInterfacePrimaryMacAddress;
    import com.pulumi.netbox.DeviceInterfacePrimaryMacAddressArgs;
    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 test = new Site("test", SiteArgs.builder()
                .name("test-site")
                .build());
    
            var testManufacturer = new Manufacturer("testManufacturer", ManufacturerArgs.builder()
                .name("test-manufacturer")
                .build());
    
            var testDeviceType = new DeviceType("testDeviceType", DeviceTypeArgs.builder()
                .manufacturerId(testManufacturer.manufacturerId())
                .model("test-device-type")
                .build());
    
            var testDeviceRole = new DeviceRole("testDeviceRole", DeviceRoleArgs.builder()
                .name("test-device-role")
                .build());
    
            var testDevice = new Device("testDevice", DeviceArgs.builder()
                .name("test-device")
                .deviceTypeId(testDeviceType.deviceTypeId())
                .roleId(testDeviceRole.deviceRoleId())
                .siteId(test.siteId())
                .build());
    
            var testDeviceInterface = new DeviceInterface("testDeviceInterface", DeviceInterfaceArgs.builder()
                .deviceId(testDevice.deviceId())
                .name("test-interface")
                .type("1000base-t")
                .build());
    
            var testMacAddress = new MacAddress("testMacAddress", MacAddressArgs.builder()
                .macAddress("00:11:22:33:44:55")
                .deviceInterfaceId(testDeviceInterface.deviceInterfaceId())
                .build());
    
            var testDeviceInterfacePrimaryMacAddress = new DeviceInterfacePrimaryMacAddress("testDeviceInterfacePrimaryMacAddress", DeviceInterfacePrimaryMacAddressArgs.builder()
                .deviceInterfaceId(testDeviceInterface.deviceInterfaceId())
                .macAddressId(testMacAddress.macAddressId())
                .build());
    
        }
    }
    
    resources:
      test:
        type: netbox:Site
        properties:
          name: test-site
      testManufacturer:
        type: netbox:Manufacturer
        name: test
        properties:
          name: test-manufacturer
      testDeviceType:
        type: netbox:DeviceType
        name: test
        properties:
          manufacturerId: ${testManufacturer.manufacturerId}
          model: test-device-type
      testDeviceRole:
        type: netbox:DeviceRole
        name: test
        properties:
          name: test-device-role
      testDevice:
        type: netbox:Device
        name: test
        properties:
          name: test-device
          deviceTypeId: ${testDeviceType.deviceTypeId}
          roleId: ${testDeviceRole.deviceRoleId}
          siteId: ${test.siteId}
      testDeviceInterface:
        type: netbox:DeviceInterface
        name: test
        properties:
          deviceId: ${testDevice.deviceId}
          name: test-interface
          type: 1000base-t
      testMacAddress:
        type: netbox:MacAddress
        name: test
        properties:
          macAddress: 00:11:22:33:44:55
          deviceInterfaceId: ${testDeviceInterface.deviceInterfaceId}
      testDeviceInterfacePrimaryMacAddress:
        type: netbox:DeviceInterfacePrimaryMacAddress
        name: test
        properties:
          deviceInterfaceId: ${testDeviceInterface.deviceInterfaceId}
          macAddressId: ${testMacAddress.macAddressId}
    
    Example coming soon!
    

    Create DeviceInterfacePrimaryMacAddress Resource

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

    Constructor syntax

    new DeviceInterfacePrimaryMacAddress(name: string, args: DeviceInterfacePrimaryMacAddressArgs, opts?: CustomResourceOptions);
    @overload
    def DeviceInterfacePrimaryMacAddress(resource_name: str,
                                         args: DeviceInterfacePrimaryMacAddressArgs,
                                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def DeviceInterfacePrimaryMacAddress(resource_name: str,
                                         opts: Optional[ResourceOptions] = None,
                                         device_interface_id: Optional[float] = None,
                                         mac_address_id: Optional[float] = None)
    func NewDeviceInterfacePrimaryMacAddress(ctx *Context, name string, args DeviceInterfacePrimaryMacAddressArgs, opts ...ResourceOption) (*DeviceInterfacePrimaryMacAddress, error)
    public DeviceInterfacePrimaryMacAddress(string name, DeviceInterfacePrimaryMacAddressArgs args, CustomResourceOptions? opts = null)
    public DeviceInterfacePrimaryMacAddress(String name, DeviceInterfacePrimaryMacAddressArgs args)
    public DeviceInterfacePrimaryMacAddress(String name, DeviceInterfacePrimaryMacAddressArgs args, CustomResourceOptions options)
    
    type: netbox:DeviceInterfacePrimaryMacAddress
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "netbox_device_interface_primary_mac_address" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args DeviceInterfacePrimaryMacAddressArgs
    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 DeviceInterfacePrimaryMacAddressArgs
    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 DeviceInterfacePrimaryMacAddressArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DeviceInterfacePrimaryMacAddressArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DeviceInterfacePrimaryMacAddressArgs
    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 deviceInterfacePrimaryMacAddressResource = new Netbox.DeviceInterfacePrimaryMacAddress("deviceInterfacePrimaryMacAddressResource", new()
    {
        DeviceInterfaceId = 0.0,
        MacAddressId = 0.0,
    });
    
    example, err := netbox.NewDeviceInterfacePrimaryMacAddress(ctx, "deviceInterfacePrimaryMacAddressResource", &netbox.DeviceInterfacePrimaryMacAddressArgs{
    	DeviceInterfaceId: pulumi.Float64(0),
    	MacAddressId:      pulumi.Float64(0),
    })
    
    resource "netbox_device_interface_primary_mac_address" "deviceInterfacePrimaryMacAddressResource" {
      lifecycle {
        create_before_destroy = true
      }
      device_interface_id = 0
      mac_address_id      = 0
    }
    
    var deviceInterfacePrimaryMacAddressResource = new DeviceInterfacePrimaryMacAddress("deviceInterfacePrimaryMacAddressResource", DeviceInterfacePrimaryMacAddressArgs.builder()
        .deviceInterfaceId(0.0)
        .macAddressId(0.0)
        .build());
    
    device_interface_primary_mac_address_resource = netbox.DeviceInterfacePrimaryMacAddress("deviceInterfacePrimaryMacAddressResource",
        device_interface_id=float(0),
        mac_address_id=float(0))
    
    const deviceInterfacePrimaryMacAddressResource = new netbox.DeviceInterfacePrimaryMacAddress("deviceInterfacePrimaryMacAddressResource", {
        deviceInterfaceId: 0,
        macAddressId: 0,
    });
    
    type: netbox:DeviceInterfacePrimaryMacAddress
    properties:
        deviceInterfaceId: 0
        macAddressId: 0
    

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

    DeviceInterfaceId double
    Id of the device interface.
    MacAddressId double
    Id of the MAC address to make primary; it must be assigned to the interface.
    DeviceInterfaceId float64
    Id of the device interface.
    MacAddressId float64
    Id of the MAC address to make primary; it must be assigned to the interface.
    device_interface_id number
    Id of the device interface.
    mac_address_id number
    Id of the MAC address to make primary; it must be assigned to the interface.
    deviceInterfaceId Double
    Id of the device interface.
    macAddressId Double
    Id of the MAC address to make primary; it must be assigned to the interface.
    deviceInterfaceId number
    Id of the device interface.
    macAddressId number
    Id of the MAC address to make primary; it must be assigned to the interface.
    device_interface_id float
    Id of the device interface.
    mac_address_id float
    Id of the MAC address to make primary; it must be assigned to the interface.
    deviceInterfaceId Number
    Id of the device interface.
    macAddressId Number
    Id of the MAC address to make primary; it must be assigned to the interface.

    Outputs

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

    Get an existing DeviceInterfacePrimaryMacAddress 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?: DeviceInterfacePrimaryMacAddressState, opts?: CustomResourceOptions): DeviceInterfacePrimaryMacAddress
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            device_interface_id: Optional[float] = None,
            mac_address_id: Optional[float] = None) -> DeviceInterfacePrimaryMacAddress
    func GetDeviceInterfacePrimaryMacAddress(ctx *Context, name string, id IDInput, state *DeviceInterfacePrimaryMacAddressState, opts ...ResourceOption) (*DeviceInterfacePrimaryMacAddress, error)
    public static DeviceInterfacePrimaryMacAddress Get(string name, Input<string> id, DeviceInterfacePrimaryMacAddressState? state, CustomResourceOptions? opts = null)
    public static DeviceInterfacePrimaryMacAddress get(String name, Output<String> id, DeviceInterfacePrimaryMacAddressState state, CustomResourceOptions options)
    resources:  existingDeviceInterfacePrimaryMacAddress:    type: netbox:DeviceInterfacePrimaryMacAddress    get:      id: ${id}
    import {
      to = netbox_device_interface_primary_mac_address.example
      id = "${id}"
    }
    
    name string
    The unique name of the resulting resource.
    id Input<ID>
    The unique provider ID of the resource to look up.
    state DeviceInterfacePrimaryMacAddressState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resulting resource.
    id str
    The unique provider ID of the resource to look up.
    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 resulting resource.
    id IDInput
    The unique provider ID of the resource to look up.
    state DeviceInterfacePrimaryMacAddressState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resulting resource.
    id Input<string>
    The unique provider ID of the resource to look up.
    state DeviceInterfacePrimaryMacAddressState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resulting resource.
    id Output<String>
    The unique provider ID of the resource to look up.
    state DeviceInterfacePrimaryMacAddressState
    Known property values the provider needs, along with the ID, to find the resource. Usually not required.
    options CustomResourceOptions
    Bag of options to control resource's behavior.
    The following state arguments are supported:
    DeviceInterfaceId double
    Id of the device interface.
    MacAddressId double
    Id of the MAC address to make primary; it must be assigned to the interface.
    DeviceInterfaceId float64
    Id of the device interface.
    MacAddressId float64
    Id of the MAC address to make primary; it must be assigned to the interface.
    device_interface_id number
    Id of the device interface.
    mac_address_id number
    Id of the MAC address to make primary; it must be assigned to the interface.
    deviceInterfaceId Double
    Id of the device interface.
    macAddressId Double
    Id of the MAC address to make primary; it must be assigned to the interface.
    deviceInterfaceId number
    Id of the device interface.
    macAddressId number
    Id of the MAC address to make primary; it must be assigned to the interface.
    device_interface_id float
    Id of the device interface.
    mac_address_id float
    Id of the MAC address to make primary; it must be assigned to the interface.
    deviceInterfaceId Number
    Id of the device interface.
    macAddressId Number
    Id of the MAC address to make primary; it must be assigned to the interface.

    Import

    In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

    terraform

    The id of the device interface.

    import {

    to = netbox_device_interface_primary_mac_address.test

    id = “123”

    }

    The pulumi import command can be used, for example:

    The id of the device interface.

    $ pulumi import netbox:index/deviceInterfacePrimaryMacAddress:DeviceInterfacePrimaryMacAddress test 123
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox
    Viewing docs for netbox 6.0.1
    published on Monday, Nov 16, 2026 by e-breuninger

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial