1. Packages
  2. Packages
  3. Netbox Provider
  4. API Docs
  5. VirtualMachineInterfacePrimaryMacAddress
Viewing docs for netbox 5.4.0
published on Friday, May 29, 2026 by e-breuninger
Viewing docs for netbox 5.4.0
published on Friday, May 29, 2026 by e-breuninger

    This resource is used to define the primary MAC for a given virtual machine interface. The primary MAC is reflected in the Interface Netbox UI.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const myvm = new netbox.VirtualMachine("myvm", {
        name: "myvm-1",
        clusterId: vmwCluster01.id,
    });
    const myvmEth0 = new netbox.Interface("myvm_eth0", {
        name: "eth0",
        virtualMachineId: myvm.virtualMachineId,
    });
    const myvmMac = new netbox.MacAddress("myvm_mac", {
        macAddress: "00:10:FA:63:38:4A",
        virtualMachineInterfaceId: myvmEth0.interfaceId,
    });
    const myvmPrimaryMac = new netbox.VirtualMachineInterfacePrimaryMacAddress("myvm_primary_mac", {
        interfaceId: myvmEth0.interfaceId,
        macAddressId: myvmMac.macAddressId,
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    myvm = netbox.VirtualMachine("myvm",
        name="myvm-1",
        cluster_id=vmw_cluster01["id"])
    myvm_eth0 = netbox.Interface("myvm_eth0",
        name="eth0",
        virtual_machine_id=myvm.virtual_machine_id)
    myvm_mac = netbox.MacAddress("myvm_mac",
        mac_address="00:10:FA:63:38:4A",
        virtual_machine_interface_id=myvm_eth0.interface_id)
    myvm_primary_mac = netbox.VirtualMachineInterfacePrimaryMacAddress("myvm_primary_mac",
        interface_id=myvm_eth0.interface_id,
        mac_address_id=myvm_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 {
    		myvm, err := netbox.NewVirtualMachine(ctx, "myvm", &netbox.VirtualMachineArgs{
    			Name:      pulumi.String("myvm-1"),
    			ClusterId: pulumi.Any(vmwCluster01.Id),
    		})
    		if err != nil {
    			return err
    		}
    		myvmEth0, err := netbox.NewInterface(ctx, "myvm_eth0", &netbox.InterfaceArgs{
    			Name:             pulumi.String("eth0"),
    			VirtualMachineId: myvm.VirtualMachineId,
    		})
    		if err != nil {
    			return err
    		}
    		myvmMac, err := netbox.NewMacAddress(ctx, "myvm_mac", &netbox.MacAddressArgs{
    			MacAddress:                pulumi.String("00:10:FA:63:38:4A"),
    			VirtualMachineInterfaceId: myvmEth0.InterfaceId,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = netbox.NewVirtualMachineInterfacePrimaryMacAddress(ctx, "myvm_primary_mac", &netbox.VirtualMachineInterfacePrimaryMacAddressArgs{
    			InterfaceId:  myvmEth0.InterfaceId,
    			MacAddressId: myvmMac.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 myvm = new Netbox.VirtualMachine("myvm", new()
        {
            Name = "myvm-1",
            ClusterId = vmwCluster01.Id,
        });
    
        var myvmEth0 = new Netbox.Interface("myvm_eth0", new()
        {
            Name = "eth0",
            VirtualMachineId = myvm.VirtualMachineId,
        });
    
        var myvmMac = new Netbox.MacAddress("myvm_mac", new()
        {
            MacAddress = "00:10:FA:63:38:4A",
            VirtualMachineInterfaceId = myvmEth0.InterfaceId,
        });
    
        var myvmPrimaryMac = new Netbox.VirtualMachineInterfacePrimaryMacAddress("myvm_primary_mac", new()
        {
            InterfaceId = myvmEth0.InterfaceId,
            MacAddressId = myvmMac.MacAddressId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.VirtualMachine;
    import com.pulumi.netbox.VirtualMachineArgs;
    import com.pulumi.netbox.Interface;
    import com.pulumi.netbox.InterfaceArgs;
    import com.pulumi.netbox.MacAddress;
    import com.pulumi.netbox.MacAddressArgs;
    import com.pulumi.netbox.VirtualMachineInterfacePrimaryMacAddress;
    import com.pulumi.netbox.VirtualMachineInterfacePrimaryMacAddressArgs;
    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 myvm = new VirtualMachine("myvm", VirtualMachineArgs.builder()
                .name("myvm-1")
                .clusterId(vmwCluster01.id())
                .build());
    
            var myvmEth0 = new Interface("myvmEth0", InterfaceArgs.builder()
                .name("eth0")
                .virtualMachineId(myvm.virtualMachineId())
                .build());
    
            var myvmMac = new MacAddress("myvmMac", MacAddressArgs.builder()
                .macAddress("00:10:FA:63:38:4A")
                .virtualMachineInterfaceId(myvmEth0.interfaceId())
                .build());
    
            var myvmPrimaryMac = new VirtualMachineInterfacePrimaryMacAddress("myvmPrimaryMac", VirtualMachineInterfacePrimaryMacAddressArgs.builder()
                .interfaceId(myvmEth0.interfaceId())
                .macAddressId(myvmMac.macAddressId())
                .build());
    
        }
    }
    
    resources:
      myvm:
        type: netbox:VirtualMachine
        properties:
          name: myvm-1
          clusterId: ${vmwCluster01.id}
      myvmEth0:
        type: netbox:Interface
        name: myvm_eth0
        properties:
          name: eth0
          virtualMachineId: ${myvm.virtualMachineId}
      myvmMac:
        type: netbox:MacAddress
        name: myvm_mac
        properties:
          macAddress: 00:10:FA:63:38:4A
          virtualMachineInterfaceId: ${myvmEth0.interfaceId}
      myvmPrimaryMac:
        type: netbox:VirtualMachineInterfacePrimaryMacAddress
        name: myvm_primary_mac
        properties:
          interfaceId: ${myvmEth0.interfaceId}
          macAddressId: ${myvmMac.macAddressId}
    
    Example coming soon!
    

    Create VirtualMachineInterfacePrimaryMacAddress Resource

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

    Constructor syntax

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

    Parameters

    name string
    The unique name of the resource.
    args VirtualMachineInterfacePrimaryMacAddressArgs
    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 VirtualMachineInterfacePrimaryMacAddressArgs
    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 VirtualMachineInterfacePrimaryMacAddressArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VirtualMachineInterfacePrimaryMacAddressArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VirtualMachineInterfacePrimaryMacAddressArgs
    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 virtualMachineInterfacePrimaryMacAddressResource = new Netbox.VirtualMachineInterfacePrimaryMacAddress("virtualMachineInterfacePrimaryMacAddressResource", new()
    {
        InterfaceId = 0,
        MacAddressId = 0,
        VirtualMachineInterfacePrimaryMacAddressId = "string",
    });
    
    example, err := netbox.NewVirtualMachineInterfacePrimaryMacAddress(ctx, "virtualMachineInterfacePrimaryMacAddressResource", &netbox.VirtualMachineInterfacePrimaryMacAddressArgs{
    	InterfaceId:  pulumi.Float64(0),
    	MacAddressId: pulumi.Float64(0),
    	VirtualMachineInterfacePrimaryMacAddressId: pulumi.String("string"),
    })
    
    resource "netbox_virtualmachineinterfaceprimarymacaddress" "virtualMachineInterfacePrimaryMacAddressResource" {
      interface_id                                     = 0
      mac_address_id                                   = 0
      virtual_machine_interface_primary_mac_address_id = "string"
    }
    
    var virtualMachineInterfacePrimaryMacAddressResource = new VirtualMachineInterfacePrimaryMacAddress("virtualMachineInterfacePrimaryMacAddressResource", VirtualMachineInterfacePrimaryMacAddressArgs.builder()
        .interfaceId(0.0)
        .macAddressId(0.0)
        .virtualMachineInterfacePrimaryMacAddressId("string")
        .build());
    
    virtual_machine_interface_primary_mac_address_resource = netbox.VirtualMachineInterfacePrimaryMacAddress("virtualMachineInterfacePrimaryMacAddressResource",
        interface_id=float(0),
        mac_address_id=float(0),
        virtual_machine_interface_primary_mac_address_id="string")
    
    const virtualMachineInterfacePrimaryMacAddressResource = new netbox.VirtualMachineInterfacePrimaryMacAddress("virtualMachineInterfacePrimaryMacAddressResource", {
        interfaceId: 0,
        macAddressId: 0,
        virtualMachineInterfacePrimaryMacAddressId: "string",
    });
    
    type: netbox:VirtualMachineInterfacePrimaryMacAddress
    properties:
        interfaceId: 0
        macAddressId: 0
        virtualMachineInterfacePrimaryMacAddressId: string
    

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

    InterfaceId double
    MacAddressId double
    VirtualMachineInterfacePrimaryMacAddressId string
    The ID of this resource.
    InterfaceId float64
    MacAddressId float64
    VirtualMachineInterfacePrimaryMacAddressId string
    The ID of this resource.
    interfaceId Double
    macAddressId Double
    virtualMachineInterfacePrimaryMacAddressId String
    The ID of this resource.
    interfaceId number
    macAddressId number
    virtualMachineInterfacePrimaryMacAddressId string
    The ID of this resource.
    interfaceId Number
    macAddressId Number
    virtualMachineInterfacePrimaryMacAddressId String
    The ID of this resource.

    Outputs

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

    Get an existing VirtualMachineInterfacePrimaryMacAddress 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?: VirtualMachineInterfacePrimaryMacAddressState, opts?: CustomResourceOptions): VirtualMachineInterfacePrimaryMacAddress
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            interface_id: Optional[float] = None,
            mac_address_id: Optional[float] = None,
            virtual_machine_interface_primary_mac_address_id: Optional[str] = None) -> VirtualMachineInterfacePrimaryMacAddress
    func GetVirtualMachineInterfacePrimaryMacAddress(ctx *Context, name string, id IDInput, state *VirtualMachineInterfacePrimaryMacAddressState, opts ...ResourceOption) (*VirtualMachineInterfacePrimaryMacAddress, error)
    public static VirtualMachineInterfacePrimaryMacAddress Get(string name, Input<string> id, VirtualMachineInterfacePrimaryMacAddressState? state, CustomResourceOptions? opts = null)
    public static VirtualMachineInterfacePrimaryMacAddress get(String name, Output<String> id, VirtualMachineInterfacePrimaryMacAddressState state, CustomResourceOptions options)
    resources:  _:    type: netbox:VirtualMachineInterfacePrimaryMacAddress    get:      id: ${id}
    import {
      to = netbox_virtualmachineinterfaceprimarymacaddress.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.
    The following state arguments are supported:
    InterfaceId double
    MacAddressId double
    VirtualMachineInterfacePrimaryMacAddressId string
    The ID of this resource.
    InterfaceId float64
    MacAddressId float64
    VirtualMachineInterfacePrimaryMacAddressId string
    The ID of this resource.
    interfaceId Double
    macAddressId Double
    virtualMachineInterfacePrimaryMacAddressId String
    The ID of this resource.
    interfaceId number
    macAddressId number
    virtualMachineInterfacePrimaryMacAddressId string
    The ID of this resource.
    interfaceId Number
    macAddressId Number
    virtualMachineInterfacePrimaryMacAddressId String
    The ID of this resource.

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    Viewing docs for netbox 5.4.0
    published on Friday, May 29, 2026 by e-breuninger

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial