published on Friday, May 29, 2026 by e-breuninger
published on Friday, May 29, 2026 by e-breuninger
This resource is used to define the primary MAC for a given device interface. The primary MAC is reflected in the device interface Netbox UI.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const mydevice = new netbox.Device("mydevice", {
name: "mydevice",
deviceTypeId: test.id,
roleId: testNetboxDeviceRole.id,
siteId: testNetboxSite.id,
});
const mydeviceEth0 = new netbox.DeviceInterface("mydevice_eth0", {
name: "eth0",
deviceId: mydevice.deviceId,
type: "1000base-t",
});
const mydeviceMac = new netbox.MacAddress("mydevice_mac", {
macAddress: "00:1A:2B:3C:4D:5E",
deviceInterfaceId: mydeviceEth0.deviceInterfaceId,
});
const mydevicePrimaryMac = new netbox.DeviceInterfacePrimaryMacAddress("mydevice_primary_mac", {
interfaceId: mydeviceEth0.deviceInterfaceId,
macAddressId: mydeviceMac.macAddressId,
});
import pulumi
import pulumi_netbox as netbox
mydevice = netbox.Device("mydevice",
name="mydevice",
device_type_id=test["id"],
role_id=test_netbox_device_role["id"],
site_id=test_netbox_site["id"])
mydevice_eth0 = netbox.DeviceInterface("mydevice_eth0",
name="eth0",
device_id=mydevice.device_id,
type="1000base-t")
mydevice_mac = netbox.MacAddress("mydevice_mac",
mac_address="00:1A:2B:3C:4D:5E",
device_interface_id=mydevice_eth0.device_interface_id)
mydevice_primary_mac = netbox.DeviceInterfacePrimaryMacAddress("mydevice_primary_mac",
interface_id=mydevice_eth0.device_interface_id,
mac_address_id=mydevice_mac.mac_address_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 {
mydevice, err := netbox.NewDevice(ctx, "mydevice", &netbox.DeviceArgs{
Name: pulumi.String("mydevice"),
DeviceTypeId: pulumi.Any(test.Id),
RoleId: pulumi.Any(testNetboxDeviceRole.Id),
SiteId: pulumi.Any(testNetboxSite.Id),
})
if err != nil {
return err
}
mydeviceEth0, err := netbox.NewDeviceInterface(ctx, "mydevice_eth0", &netbox.DeviceInterfaceArgs{
Name: pulumi.String("eth0"),
DeviceId: mydevice.DeviceId,
Type: pulumi.String("1000base-t"),
})
if err != nil {
return err
}
mydeviceMac, err := netbox.NewMacAddress(ctx, "mydevice_mac", &netbox.MacAddressArgs{
MacAddress: pulumi.String("00:1A:2B:3C:4D:5E"),
DeviceInterfaceId: mydeviceEth0.DeviceInterfaceId,
})
if err != nil {
return err
}
_, err = netbox.NewDeviceInterfacePrimaryMacAddress(ctx, "mydevice_primary_mac", &netbox.DeviceInterfacePrimaryMacAddressArgs{
InterfaceId: mydeviceEth0.DeviceInterfaceId,
MacAddressId: mydeviceMac.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 mydevice = new Netbox.Device("mydevice", new()
{
Name = "mydevice",
DeviceTypeId = test.Id,
RoleId = testNetboxDeviceRole.Id,
SiteId = testNetboxSite.Id,
});
var mydeviceEth0 = new Netbox.DeviceInterface("mydevice_eth0", new()
{
Name = "eth0",
DeviceId = mydevice.DeviceId,
Type = "1000base-t",
});
var mydeviceMac = new Netbox.MacAddress("mydevice_mac", new()
{
MacAddress = "00:1A:2B:3C:4D:5E",
DeviceInterfaceId = mydeviceEth0.DeviceInterfaceId,
});
var mydevicePrimaryMac = new Netbox.DeviceInterfacePrimaryMacAddress("mydevice_primary_mac", new()
{
InterfaceId = mydeviceEth0.DeviceInterfaceId,
MacAddressId = mydeviceMac.MacAddressId,
});
});
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.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 mydevice = new Device("mydevice", DeviceArgs.builder()
.name("mydevice")
.deviceTypeId(test.id())
.roleId(testNetboxDeviceRole.id())
.siteId(testNetboxSite.id())
.build());
var mydeviceEth0 = new DeviceInterface("mydeviceEth0", DeviceInterfaceArgs.builder()
.name("eth0")
.deviceId(mydevice.deviceId())
.type("1000base-t")
.build());
var mydeviceMac = new MacAddress("mydeviceMac", MacAddressArgs.builder()
.macAddress("00:1A:2B:3C:4D:5E")
.deviceInterfaceId(mydeviceEth0.deviceInterfaceId())
.build());
var mydevicePrimaryMac = new DeviceInterfacePrimaryMacAddress("mydevicePrimaryMac", DeviceInterfacePrimaryMacAddressArgs.builder()
.interfaceId(mydeviceEth0.deviceInterfaceId())
.macAddressId(mydeviceMac.macAddressId())
.build());
}
}
resources:
mydevice:
type: netbox:Device
properties:
name: mydevice
deviceTypeId: ${test.id}
roleId: ${testNetboxDeviceRole.id}
siteId: ${testNetboxSite.id}
mydeviceEth0:
type: netbox:DeviceInterface
name: mydevice_eth0
properties:
name: eth0
deviceId: ${mydevice.deviceId}
type: 1000base-t
mydeviceMac:
type: netbox:MacAddress
name: mydevice_mac
properties:
macAddress: 00:1A:2B:3C:4D:5E
deviceInterfaceId: ${mydeviceEth0.deviceInterfaceId}
mydevicePrimaryMac:
type: netbox:DeviceInterfacePrimaryMacAddress
name: mydevice_primary_mac
properties:
interfaceId: ${mydeviceEth0.deviceInterfaceId}
macAddressId: ${mydeviceMac.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,
interface_id: Optional[float] = None,
mac_address_id: Optional[float] = None,
device_interface_primary_mac_address_id: Optional[str] = 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_deviceinterfaceprimarymacaddress" "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()
{
InterfaceId = 0,
MacAddressId = 0,
DeviceInterfacePrimaryMacAddressId = "string",
});
example, err := netbox.NewDeviceInterfacePrimaryMacAddress(ctx, "deviceInterfacePrimaryMacAddressResource", &netbox.DeviceInterfacePrimaryMacAddressArgs{
InterfaceId: pulumi.Float64(0),
MacAddressId: pulumi.Float64(0),
DeviceInterfacePrimaryMacAddressId: pulumi.String("string"),
})
resource "netbox_deviceinterfaceprimarymacaddress" "deviceInterfacePrimaryMacAddressResource" {
interface_id = 0
mac_address_id = 0
device_interface_primary_mac_address_id = "string"
}
var deviceInterfacePrimaryMacAddressResource = new DeviceInterfacePrimaryMacAddress("deviceInterfacePrimaryMacAddressResource", DeviceInterfacePrimaryMacAddressArgs.builder()
.interfaceId(0.0)
.macAddressId(0.0)
.deviceInterfacePrimaryMacAddressId("string")
.build());
device_interface_primary_mac_address_resource = netbox.DeviceInterfacePrimaryMacAddress("deviceInterfacePrimaryMacAddressResource",
interface_id=float(0),
mac_address_id=float(0),
device_interface_primary_mac_address_id="string")
const deviceInterfacePrimaryMacAddressResource = new netbox.DeviceInterfacePrimaryMacAddress("deviceInterfacePrimaryMacAddressResource", {
interfaceId: 0,
macAddressId: 0,
deviceInterfacePrimaryMacAddressId: "string",
});
type: netbox:DeviceInterfacePrimaryMacAddress
properties:
deviceInterfacePrimaryMacAddressId: string
interfaceId: 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:
- Interface
Id double - Mac
Address doubleId - Device
Interface stringPrimary Mac Address Id - The ID of this resource.
- Interface
Id float64 - Mac
Address float64Id - Device
Interface stringPrimary Mac Address Id - The ID of this resource.
- interface_
id number - mac_
address_ numberid - device_
interface_ stringprimary_ mac_ address_ id - The ID of this resource.
- interface
Id Double - mac
Address DoubleId - device
Interface StringPrimary Mac Address Id - The ID of this resource.
- interface
Id number - mac
Address numberId - device
Interface stringPrimary Mac Address Id - The ID of this resource.
- interface_
id float - mac_
address_ floatid - device_
interface_ strprimary_ mac_ address_ id - The ID of this resource.
- interface
Id Number - mac
Address NumberId - device
Interface StringPrimary Mac Address Id - The ID of this resource.
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_primary_mac_address_id: Optional[str] = None,
interface_id: Optional[float] = None,
mac_address_id: Optional[float] = None) -> DeviceInterfacePrimaryMacAddressfunc 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: _: type: netbox:DeviceInterfacePrimaryMacAddress get: id: ${id}import {
to = netbox_deviceinterfaceprimarymacaddress.example
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.
- Device
Interface stringPrimary Mac Address Id - The ID of this resource.
- Interface
Id double - Mac
Address doubleId
- Device
Interface stringPrimary Mac Address Id - The ID of this resource.
- Interface
Id float64 - Mac
Address float64Id
- device_
interface_ stringprimary_ mac_ address_ id - The ID of this resource.
- interface_
id number - mac_
address_ numberid
- device
Interface StringPrimary Mac Address Id - The ID of this resource.
- interface
Id Double - mac
Address DoubleId
- device
Interface stringPrimary Mac Address Id - The ID of this resource.
- interface
Id number - mac
Address numberId
- device_
interface_ strprimary_ mac_ address_ id - The ID of this resource.
- interface_
id float - mac_
address_ floatid
- device
Interface StringPrimary Mac Address Id - The ID of this resource.
- interface
Id Number - mac
Address NumberId
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netboxTerraform Provider.
published on Friday, May 29, 2026 by e-breuninger