1. Packages
  2. Netaddr Provider
  3. API Docs
  4. AddressMac
netaddr 0.5.1 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine

netaddr.AddressMac

Explore with Pulumi AI

Mac address.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as netaddr from "@pulumi/netaddr";

const testRangeMac = new netaddr.RangeMac("testRangeMac", {
    keyPrefix: "/test/mac/",
    firstAddress: "52:54:00:00:00:00",
    lastAddress: "52:54:00:ff:ff:ff",
});
const testAddressMac = new netaddr.AddressMac("testAddressMac", {
    rangeId: testRangeMac.rangeMacId,
    hardcodedAddress: "52:54:00:00:00:02",
});
const test2 = new netaddr.AddressMac("test2", {rangeId: testRangeMac.rangeMacId});
export const testAddr = testAddressMac.address;
export const test2Addr = test2.address;
Copy
import pulumi
import pulumi_netaddr as netaddr

test_range_mac = netaddr.RangeMac("testRangeMac",
    key_prefix="/test/mac/",
    first_address="52:54:00:00:00:00",
    last_address="52:54:00:ff:ff:ff")
test_address_mac = netaddr.AddressMac("testAddressMac",
    range_id=test_range_mac.range_mac_id,
    hardcoded_address="52:54:00:00:00:02")
test2 = netaddr.AddressMac("test2", range_id=test_range_mac.range_mac_id)
pulumi.export("testAddr", test_address_mac.address)
pulumi.export("test2Addr", test2.address)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netaddr/netaddr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testRangeMac, err := netaddr.NewRangeMac(ctx, "testRangeMac", &netaddr.RangeMacArgs{
			KeyPrefix:    pulumi.String("/test/mac/"),
			FirstAddress: pulumi.String("52:54:00:00:00:00"),
			LastAddress:  pulumi.String("52:54:00:ff:ff:ff"),
		})
		if err != nil {
			return err
		}
		testAddressMac, err := netaddr.NewAddressMac(ctx, "testAddressMac", &netaddr.AddressMacArgs{
			RangeId:          testRangeMac.RangeMacId,
			HardcodedAddress: pulumi.String("52:54:00:00:00:02"),
		})
		if err != nil {
			return err
		}
		test2, err := netaddr.NewAddressMac(ctx, "test2", &netaddr.AddressMacArgs{
			RangeId: testRangeMac.RangeMacId,
		})
		if err != nil {
			return err
		}
		ctx.Export("testAddr", testAddressMac.Address)
		ctx.Export("test2Addr", test2.Address)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netaddr = Pulumi.Netaddr;

return await Deployment.RunAsync(() => 
{
    var testRangeMac = new Netaddr.RangeMac("testRangeMac", new()
    {
        KeyPrefix = "/test/mac/",
        FirstAddress = "52:54:00:00:00:00",
        LastAddress = "52:54:00:ff:ff:ff",
    });

    var testAddressMac = new Netaddr.AddressMac("testAddressMac", new()
    {
        RangeId = testRangeMac.RangeMacId,
        HardcodedAddress = "52:54:00:00:00:02",
    });

    var test2 = new Netaddr.AddressMac("test2", new()
    {
        RangeId = testRangeMac.RangeMacId,
    });

    return new Dictionary<string, object?>
    {
        ["testAddr"] = testAddressMac.Address,
        ["test2Addr"] = test2.Address,
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netaddr.RangeMac;
import com.pulumi.netaddr.RangeMacArgs;
import com.pulumi.netaddr.AddressMac;
import com.pulumi.netaddr.AddressMacArgs;
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 testRangeMac = new RangeMac("testRangeMac", RangeMacArgs.builder()
            .keyPrefix("/test/mac/")
            .firstAddress("52:54:00:00:00:00")
            .lastAddress("52:54:00:ff:ff:ff")
            .build());

        var testAddressMac = new AddressMac("testAddressMac", AddressMacArgs.builder()
            .rangeId(testRangeMac.rangeMacId())
            .hardcodedAddress("52:54:00:00:00:02")
            .build());

        var test2 = new AddressMac("test2", AddressMacArgs.builder()
            .rangeId(testRangeMac.rangeMacId())
            .build());

        ctx.export("testAddr", testAddressMac.address());
        ctx.export("test2Addr", test2.address());
    }
}
Copy
resources:
  testRangeMac:
    type: netaddr:RangeMac
    properties:
      keyPrefix: /test/mac/
      firstAddress: 52:54:00:00:00:00
      lastAddress: 52:54:00:ff:ff:ff
  testAddressMac:
    type: netaddr:AddressMac
    properties:
      rangeId: ${testRangeMac.rangeMacId}
      hardcodedAddress: 52:54:00:00:00:02
  test2:
    type: netaddr:AddressMac
    properties:
      rangeId: ${testRangeMac.rangeMacId}
outputs:
  testAddr: ${testAddressMac.address}
  test2Addr: ${test2.address}
Copy

Create AddressMac Resource

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

Constructor syntax

new AddressMac(name: string, args: AddressMacArgs, opts?: CustomResourceOptions);
@overload
def AddressMac(resource_name: str,
               args: AddressMacArgs,
               opts: Optional[ResourceOptions] = None)

@overload
def AddressMac(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               range_id: Optional[str] = None,
               address_mac_id: Optional[str] = None,
               hardcoded_address: Optional[str] = None,
               name: Optional[str] = None)
func NewAddressMac(ctx *Context, name string, args AddressMacArgs, opts ...ResourceOption) (*AddressMac, error)
public AddressMac(string name, AddressMacArgs args, CustomResourceOptions? opts = null)
public AddressMac(String name, AddressMacArgs args)
public AddressMac(String name, AddressMacArgs args, CustomResourceOptions options)
type: netaddr:AddressMac
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. AddressMacArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. AddressMacArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. AddressMacArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. AddressMacArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. AddressMacArgs
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 addressMacResource = new Netaddr.AddressMac("addressMacResource", new()
{
    RangeId = "string",
    AddressMacId = "string",
    HardcodedAddress = "string",
    Name = "string",
});
Copy
example, err := netaddr.NewAddressMac(ctx, "addressMacResource", &netaddr.AddressMacArgs{
	RangeId:          pulumi.String("string"),
	AddressMacId:     pulumi.String("string"),
	HardcodedAddress: pulumi.String("string"),
	Name:             pulumi.String("string"),
})
Copy
var addressMacResource = new AddressMac("addressMacResource", AddressMacArgs.builder()
    .rangeId("string")
    .addressMacId("string")
    .hardcodedAddress("string")
    .name("string")
    .build());
Copy
address_mac_resource = netaddr.AddressMac("addressMacResource",
    range_id="string",
    address_mac_id="string",
    hardcoded_address="string",
    name="string")
Copy
const addressMacResource = new netaddr.AddressMac("addressMacResource", {
    rangeId: "string",
    addressMacId: "string",
    hardcodedAddress: "string",
    name: "string",
});
Copy
type: netaddr:AddressMac
properties:
    addressMacId: string
    hardcodedAddress: string
    name: string
    rangeId: string
Copy

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

RangeId This property is required. string
Identifier of the address range the address is tied to.
AddressMacId string
The ID of this resource.
HardcodedAddress string
An optional input to fixate the address to a specific value.
Name string
Name to associate with the address.
RangeId This property is required. string
Identifier of the address range the address is tied to.
AddressMacId string
The ID of this resource.
HardcodedAddress string
An optional input to fixate the address to a specific value.
Name string
Name to associate with the address.
rangeId This property is required. String
Identifier of the address range the address is tied to.
addressMacId String
The ID of this resource.
hardcodedAddress String
An optional input to fixate the address to a specific value.
name String
Name to associate with the address.
rangeId This property is required. string
Identifier of the address range the address is tied to.
addressMacId string
The ID of this resource.
hardcodedAddress string
An optional input to fixate the address to a specific value.
name string
Name to associate with the address.
range_id This property is required. str
Identifier of the address range the address is tied to.
address_mac_id str
The ID of this resource.
hardcoded_address str
An optional input to fixate the address to a specific value.
name str
Name to associate with the address.
rangeId This property is required. String
Identifier of the address range the address is tied to.
addressMacId String
The ID of this resource.
hardcodedAddress String
An optional input to fixate the address to a specific value.
name String
Name to associate with the address.

Outputs

All input properties are implicitly available as output properties. Additionally, the AddressMac resource produces the following output properties:

Address string
The address that got assigned to the resource.
Id string
The provider-assigned unique ID for this managed resource.
Address string
The address that got assigned to the resource.
Id string
The provider-assigned unique ID for this managed resource.
address String
The address that got assigned to the resource.
id String
The provider-assigned unique ID for this managed resource.
address string
The address that got assigned to the resource.
id string
The provider-assigned unique ID for this managed resource.
address str
The address that got assigned to the resource.
id str
The provider-assigned unique ID for this managed resource.
address String
The address that got assigned to the resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing AddressMac Resource

Get an existing AddressMac 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?: AddressMacState, opts?: CustomResourceOptions): AddressMac
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        address: Optional[str] = None,
        address_mac_id: Optional[str] = None,
        hardcoded_address: Optional[str] = None,
        name: Optional[str] = None,
        range_id: Optional[str] = None) -> AddressMac
func GetAddressMac(ctx *Context, name string, id IDInput, state *AddressMacState, opts ...ResourceOption) (*AddressMac, error)
public static AddressMac Get(string name, Input<string> id, AddressMacState? state, CustomResourceOptions? opts = null)
public static AddressMac get(String name, Output<String> id, AddressMacState state, CustomResourceOptions options)
resources:  _:    type: netaddr:AddressMac    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Address string
The address that got assigned to the resource.
AddressMacId string
The ID of this resource.
HardcodedAddress string
An optional input to fixate the address to a specific value.
Name string
Name to associate with the address.
RangeId string
Identifier of the address range the address is tied to.
Address string
The address that got assigned to the resource.
AddressMacId string
The ID of this resource.
HardcodedAddress string
An optional input to fixate the address to a specific value.
Name string
Name to associate with the address.
RangeId string
Identifier of the address range the address is tied to.
address String
The address that got assigned to the resource.
addressMacId String
The ID of this resource.
hardcodedAddress String
An optional input to fixate the address to a specific value.
name String
Name to associate with the address.
rangeId String
Identifier of the address range the address is tied to.
address string
The address that got assigned to the resource.
addressMacId string
The ID of this resource.
hardcodedAddress string
An optional input to fixate the address to a specific value.
name string
Name to associate with the address.
rangeId string
Identifier of the address range the address is tied to.
address str
The address that got assigned to the resource.
address_mac_id str
The ID of this resource.
hardcoded_address str
An optional input to fixate the address to a specific value.
name str
Name to associate with the address.
range_id str
Identifier of the address range the address is tied to.
address String
The address that got assigned to the resource.
addressMacId String
The ID of this resource.
hardcodedAddress String
An optional input to fixate the address to a specific value.
name String
Name to associate with the address.
rangeId String
Identifier of the address range the address is tied to.

Package Details

Repository
netaddr ferlab-ste-justine/terraform-provider-netaddr
License
Notes
This Pulumi package is based on the netaddr Terraform Provider.