published on Monday, Nov 16, 2026 by e-breuninger
published on Monday, Nov 16, 2026 by e-breuninger
Sets the primary MAC address of a virtual machine interface. The address must be assigned to that interface (netbox_mac_address with virtual_machine_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.ClusterType("test", {name: "test-cluster-type"});
const testCluster = new netbox.Cluster("test", {
name: "test-cluster",
clusterTypeId: test.clusterTypeId,
});
const testVirtualMachine = new netbox.VirtualMachine("test", {
name: "test-virtual-machine",
clusterId: testCluster.clusterId,
});
const testVirtualMachineInterface = new netbox.VirtualMachineInterface("test", {
virtualMachineId: testVirtualMachine.virtualMachineId,
name: "test-interface",
});
const testMacAddress = new netbox.MacAddress("test", {
macAddress: "00:11:22:33:44:55",
virtualMachineInterfaceId: testVirtualMachineInterface.virtualMachineInterfaceId,
});
const testVirtualMachineInterfacePrimaryMacAddress = new netbox.VirtualMachineInterfacePrimaryMacAddress("test", {
virtualMachineInterfaceId: testVirtualMachineInterface.virtualMachineInterfaceId,
macAddressId: testMacAddress.macAddressId,
});
import pulumi
import pulumi_netbox as netbox
test = netbox.ClusterType("test", name="test-cluster-type")
test_cluster = netbox.Cluster("test",
name="test-cluster",
cluster_type_id=test.cluster_type_id)
test_virtual_machine = netbox.VirtualMachine("test",
name="test-virtual-machine",
cluster_id=test_cluster.cluster_id)
test_virtual_machine_interface = netbox.VirtualMachineInterface("test",
virtual_machine_id=test_virtual_machine.virtual_machine_id,
name="test-interface")
test_mac_address = netbox.MacAddress("test",
mac_address="00:11:22:33:44:55",
virtual_machine_interface_id=test_virtual_machine_interface.virtual_machine_interface_id)
test_virtual_machine_interface_primary_mac_address = netbox.VirtualMachineInterfacePrimaryMacAddress("test",
virtual_machine_interface_id=test_virtual_machine_interface.virtual_machine_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.NewClusterType(ctx, "test", &netbox.ClusterTypeArgs{
Name: pulumi.String("test-cluster-type"),
})
if err != nil {
return err
}
testCluster, err := netbox.NewCluster(ctx, "test", &netbox.ClusterArgs{
Name: pulumi.String("test-cluster"),
ClusterTypeId: test.ClusterTypeId,
})
if err != nil {
return err
}
testVirtualMachine, err := netbox.NewVirtualMachine(ctx, "test", &netbox.VirtualMachineArgs{
Name: pulumi.String("test-virtual-machine"),
ClusterId: testCluster.ClusterId,
})
if err != nil {
return err
}
testVirtualMachineInterface, err := netbox.NewVirtualMachineInterface(ctx, "test", &netbox.VirtualMachineInterfaceArgs{
VirtualMachineId: testVirtualMachine.VirtualMachineId,
Name: pulumi.String("test-interface"),
})
if err != nil {
return err
}
testMacAddress, err := netbox.NewMacAddress(ctx, "test", &netbox.MacAddressArgs{
MacAddress: pulumi.String("00:11:22:33:44:55"),
VirtualMachineInterfaceId: testVirtualMachineInterface.VirtualMachineInterfaceId,
})
if err != nil {
return err
}
_, err = netbox.NewVirtualMachineInterfacePrimaryMacAddress(ctx, "test", &netbox.VirtualMachineInterfacePrimaryMacAddressArgs{
VirtualMachineInterfaceId: testVirtualMachineInterface.VirtualMachineInterfaceId,
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.ClusterType("test", new()
{
Name = "test-cluster-type",
});
var testCluster = new Netbox.Cluster("test", new()
{
Name = "test-cluster",
ClusterTypeId = test.ClusterTypeId,
});
var testVirtualMachine = new Netbox.VirtualMachine("test", new()
{
Name = "test-virtual-machine",
ClusterId = testCluster.ClusterId,
});
var testVirtualMachineInterface = new Netbox.VirtualMachineInterface("test", new()
{
VirtualMachineId = testVirtualMachine.VirtualMachineId,
Name = "test-interface",
});
var testMacAddress = new Netbox.MacAddress("test", new()
{
MacAddress = "00:11:22:33:44:55",
VirtualMachineInterfaceId = testVirtualMachineInterface.VirtualMachineInterfaceId,
});
var testVirtualMachineInterfacePrimaryMacAddress = new Netbox.VirtualMachineInterfacePrimaryMacAddress("test", new()
{
VirtualMachineInterfaceId = testVirtualMachineInterface.VirtualMachineInterfaceId,
MacAddressId = testMacAddress.MacAddressId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.ClusterType;
import com.pulumi.netbox.ClusterTypeArgs;
import com.pulumi.netbox.Cluster;
import com.pulumi.netbox.ClusterArgs;
import com.pulumi.netbox.VirtualMachine;
import com.pulumi.netbox.VirtualMachineArgs;
import com.pulumi.netbox.VirtualMachineInterface;
import com.pulumi.netbox.VirtualMachineInterfaceArgs;
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 test = new ClusterType("test", ClusterTypeArgs.builder()
.name("test-cluster-type")
.build());
var testCluster = new Cluster("testCluster", ClusterArgs.builder()
.name("test-cluster")
.clusterTypeId(test.clusterTypeId())
.build());
var testVirtualMachine = new VirtualMachine("testVirtualMachine", VirtualMachineArgs.builder()
.name("test-virtual-machine")
.clusterId(testCluster.clusterId())
.build());
var testVirtualMachineInterface = new VirtualMachineInterface("testVirtualMachineInterface", VirtualMachineInterfaceArgs.builder()
.virtualMachineId(testVirtualMachine.virtualMachineId())
.name("test-interface")
.build());
var testMacAddress = new MacAddress("testMacAddress", MacAddressArgs.builder()
.macAddress("00:11:22:33:44:55")
.virtualMachineInterfaceId(testVirtualMachineInterface.virtualMachineInterfaceId())
.build());
var testVirtualMachineInterfacePrimaryMacAddress = new VirtualMachineInterfacePrimaryMacAddress("testVirtualMachineInterfacePrimaryMacAddress", VirtualMachineInterfacePrimaryMacAddressArgs.builder()
.virtualMachineInterfaceId(testVirtualMachineInterface.virtualMachineInterfaceId())
.macAddressId(testMacAddress.macAddressId())
.build());
}
}
resources:
test:
type: netbox:ClusterType
properties:
name: test-cluster-type
testCluster:
type: netbox:Cluster
name: test
properties:
name: test-cluster
clusterTypeId: ${test.clusterTypeId}
testVirtualMachine:
type: netbox:VirtualMachine
name: test
properties:
name: test-virtual-machine
clusterId: ${testCluster.clusterId}
testVirtualMachineInterface:
type: netbox:VirtualMachineInterface
name: test
properties:
virtualMachineId: ${testVirtualMachine.virtualMachineId}
name: test-interface
testMacAddress:
type: netbox:MacAddress
name: test
properties:
macAddress: 00:11:22:33:44:55
virtualMachineInterfaceId: ${testVirtualMachineInterface.virtualMachineInterfaceId}
testVirtualMachineInterfacePrimaryMacAddress:
type: netbox:VirtualMachineInterfacePrimaryMacAddress
name: test
properties:
virtualMachineInterfaceId: ${testVirtualMachineInterface.virtualMachineInterfaceId}
macAddressId: ${testMacAddress.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,
mac_address_id: Optional[float] = None,
virtual_machine_interface_id: Optional[float] = 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_virtual_machine_interface_primary_mac_address" "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()
{
MacAddressId = 0.0,
VirtualMachineInterfaceId = 0.0,
});
example, err := netbox.NewVirtualMachineInterfacePrimaryMacAddress(ctx, "virtualMachineInterfacePrimaryMacAddressResource", &netbox.VirtualMachineInterfacePrimaryMacAddressArgs{
MacAddressId: pulumi.Float64(0),
VirtualMachineInterfaceId: pulumi.Float64(0),
})
resource "netbox_virtual_machine_interface_primary_mac_address" "virtualMachineInterfacePrimaryMacAddressResource" {
lifecycle {
create_before_destroy = true
}
mac_address_id = 0
virtual_machine_interface_id = 0
}
var virtualMachineInterfacePrimaryMacAddressResource = new VirtualMachineInterfacePrimaryMacAddress("virtualMachineInterfacePrimaryMacAddressResource", VirtualMachineInterfacePrimaryMacAddressArgs.builder()
.macAddressId(0.0)
.virtualMachineInterfaceId(0.0)
.build());
virtual_machine_interface_primary_mac_address_resource = netbox.VirtualMachineInterfacePrimaryMacAddress("virtualMachineInterfacePrimaryMacAddressResource",
mac_address_id=float(0),
virtual_machine_interface_id=float(0))
const virtualMachineInterfacePrimaryMacAddressResource = new netbox.VirtualMachineInterfacePrimaryMacAddress("virtualMachineInterfacePrimaryMacAddressResource", {
macAddressId: 0,
virtualMachineInterfaceId: 0,
});
type: netbox:VirtualMachineInterfacePrimaryMacAddress
properties:
macAddressId: 0
virtualMachineInterfaceId: 0
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:
- Mac
Address doubleId - Id of the MAC address to make primary; it must be assigned to the interface.
- Virtual
Machine doubleInterface Id - Id of the virtual machine interface.
- Mac
Address float64Id - Id of the MAC address to make primary; it must be assigned to the interface.
- Virtual
Machine float64Interface Id - Id of the virtual machine interface.
- mac_
address_ numberid - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual_
machine_ numberinterface_ id - Id of the virtual machine interface.
- mac
Address DoubleId - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual
Machine DoubleInterface Id - Id of the virtual machine interface.
- mac
Address numberId - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual
Machine numberInterface Id - Id of the virtual machine interface.
- mac_
address_ floatid - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual_
machine_ floatinterface_ id - Id of the virtual machine interface.
- mac
Address NumberId - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual
Machine NumberInterface Id - Id of the virtual machine interface.
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,
mac_address_id: Optional[float] = None,
virtual_machine_interface_id: Optional[float] = None) -> VirtualMachineInterfacePrimaryMacAddressfunc 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: existingVirtualMachineInterfacePrimaryMacAddress: type: netbox:VirtualMachineInterfacePrimaryMacAddress get: id: ${id}import {
to = netbox_virtual_machine_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 VirtualMachineInterfacePrimaryMacAddressState
- 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 VirtualMachineInterfacePrimaryMacAddressState
- 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 VirtualMachineInterfacePrimaryMacAddressState
- 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 VirtualMachineInterfacePrimaryMacAddressState
- 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.
- Mac
Address doubleId - Id of the MAC address to make primary; it must be assigned to the interface.
- Virtual
Machine doubleInterface Id - Id of the virtual machine interface.
- Mac
Address float64Id - Id of the MAC address to make primary; it must be assigned to the interface.
- Virtual
Machine float64Interface Id - Id of the virtual machine interface.
- mac_
address_ numberid - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual_
machine_ numberinterface_ id - Id of the virtual machine interface.
- mac
Address DoubleId - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual
Machine DoubleInterface Id - Id of the virtual machine interface.
- mac
Address numberId - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual
Machine numberInterface Id - Id of the virtual machine interface.
- mac_
address_ floatid - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual_
machine_ floatinterface_ id - Id of the virtual machine interface.
- mac
Address NumberId - Id of the MAC address to make primary; it must be assigned to the interface.
- virtual
Machine NumberInterface Id - Id of the virtual machine 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 virtual machine interface.
import {
to = netbox_virtual_machine_interface_primary_mac_address.test
id = “123”
}
The pulumi import command can be used, for example:
The id of the virtual machine interface.
$ pulumi import netbox:index/virtualMachineInterfacePrimaryMacAddress:VirtualMachineInterfacePrimaryMacAddress 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
netboxTerraform Provider.
published on Monday, Nov 16, 2026 by e-breuninger