1. Packages
  2. Equinix
  3. API Docs
  4. metal
  5. getDevice
Equinix v0.21.0 published on Friday, Feb 28, 2025 by Equinix

equinix.metal.getDevice

Explore with Pulumi AI

Equinix v0.21.0 published on Friday, Feb 28, 2025 by Equinix

The datasource can be used to fetch a single device.

If you need to fetch a list of devices which meet filter criteria, you can use the equinix.metal.getDevices datasource.

Note: All arguments including the root_password and user_data will be stored in the raw state as plain-text. Read more about sensitive data in state.

Example Usage

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

const test = equinix.metal.getDevice({
    projectId: local.project_id,
    hostname: "mydevice",
});
export const id = test.then(test => test.id);
Copy
import pulumi
import pulumi_equinix as equinix

test = equinix.metal.get_device(project_id=local["project_id"],
    hostname="mydevice")
pulumi.export("id", test.id)
Copy
package main

import (
	"github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		test, err := metal.LookupDevice(ctx, &metal.LookupDeviceArgs{
			ProjectId: pulumi.StringRef(local.Project_id),
			Hostname:  pulumi.StringRef("mydevice"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("id", test.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Equinix = Pulumi.Equinix;

return await Deployment.RunAsync(() => 
{
    var test = Equinix.Metal.GetDevice.Invoke(new()
    {
        ProjectId = local.Project_id,
        Hostname = "mydevice",
    });

    return new Dictionary<string, object?>
    {
        ["id"] = test.Apply(getDeviceResult => getDeviceResult.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.equinix.metal.MetalFunctions;
import com.pulumi.equinix.metal.inputs.GetDeviceArgs;
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) {
        final var test = MetalFunctions.getDevice(GetDeviceArgs.builder()
            .projectId(local.project_id())
            .hostname("mydevice")
            .build());

        ctx.export("id", test.applyValue(getDeviceResult -> getDeviceResult.id()));
    }
}
Copy
variables:
  test:
    fn::invoke:
      Function: equinix:metal:getDevice
      Arguments:
        projectId: ${local.project_id}
        hostname: mydevice
outputs:
  id: ${test.id}
Copy
import * as pulumi from "@pulumi/pulumi";
import * as equinix from "@pulumi/equinix";

const test = equinix.metal.getDevice({
    deviceId: "4c641195-25e5-4c3c-b2b7-4cd7a42c7b40",
});
export const ipv4 = test.then(test => test.accessPublicIpv4);
Copy
import pulumi
import pulumi_equinix as equinix

test = equinix.metal.get_device(device_id="4c641195-25e5-4c3c-b2b7-4cd7a42c7b40")
pulumi.export("ipv4", test.access_public_ipv4)
Copy
package main

import (
	"github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		test, err := metal.LookupDevice(ctx, &metal.LookupDeviceArgs{
			DeviceId: pulumi.StringRef("4c641195-25e5-4c3c-b2b7-4cd7a42c7b40"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("ipv4", test.AccessPublicIpv4)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Equinix = Pulumi.Equinix;

return await Deployment.RunAsync(() => 
{
    var test = Equinix.Metal.GetDevice.Invoke(new()
    {
        DeviceId = "4c641195-25e5-4c3c-b2b7-4cd7a42c7b40",
    });

    return new Dictionary<string, object?>
    {
        ["ipv4"] = test.Apply(getDeviceResult => getDeviceResult.AccessPublicIpv4),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.equinix.metal.MetalFunctions;
import com.pulumi.equinix.metal.inputs.GetDeviceArgs;
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) {
        final var test = MetalFunctions.getDevice(GetDeviceArgs.builder()
            .deviceId("4c641195-25e5-4c3c-b2b7-4cd7a42c7b40")
            .build());

        ctx.export("ipv4", test.applyValue(getDeviceResult -> getDeviceResult.accessPublicIpv4()));
    }
}
Copy
variables:
  test:
    fn::invoke:
      Function: equinix:metal:getDevice
      Arguments:
        deviceId: 4c641195-25e5-4c3c-b2b7-4cd7a42c7b40
outputs:
  ipv4: ${test.accessPublicIpv4}
Copy

Using getDevice

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getDevice(args: GetDeviceArgs, opts?: InvokeOptions): Promise<GetDeviceResult>
function getDeviceOutput(args: GetDeviceOutputArgs, opts?: InvokeOptions): Output<GetDeviceResult>
Copy
def get_device(device_id: Optional[str] = None,
               hostname: Optional[str] = None,
               project_id: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetDeviceResult
def get_device_output(device_id: Optional[pulumi.Input[str]] = None,
               hostname: Optional[pulumi.Input[str]] = None,
               project_id: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetDeviceResult]
Copy
func LookupDevice(ctx *Context, args *LookupDeviceArgs, opts ...InvokeOption) (*LookupDeviceResult, error)
func LookupDeviceOutput(ctx *Context, args *LookupDeviceOutputArgs, opts ...InvokeOption) LookupDeviceResultOutput
Copy

> Note: This function is named LookupDevice in the Go SDK.

public static class GetDevice 
{
    public static Task<GetDeviceResult> InvokeAsync(GetDeviceArgs args, InvokeOptions? opts = null)
    public static Output<GetDeviceResult> Invoke(GetDeviceInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDeviceResult> getDevice(GetDeviceArgs args, InvokeOptions options)
public static Output<GetDeviceResult> getDevice(GetDeviceArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: equinix:metal/getDevice:getDevice
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

DeviceId string
Device ID
Hostname string
The device name
ProjectId string
The id of the project in which the devices exists
DeviceId string
Device ID
Hostname string
The device name
ProjectId string
The id of the project in which the devices exists
deviceId String
Device ID
hostname String
The device name
projectId String
The id of the project in which the devices exists
deviceId string
Device ID
hostname string
The device name
projectId string
The id of the project in which the devices exists
device_id str
Device ID
hostname str
The device name
project_id str
The id of the project in which the devices exists
deviceId String
Device ID
hostname String
The device name
projectId String
The id of the project in which the devices exists

getDevice Result

The following output properties are available:

AccessPrivateIpv4 string
The ipv4 private IP assigned to the device
AccessPublicIpv4 string
The ipv4 management IP assigned to the device
AccessPublicIpv6 string
The ipv6 management IP assigned to the device
AlwaysPxe bool
BillingCycle string
The billing cycle of the device (monthly or hourly)
Description string
Description string for the device
DeviceId string
Device ID
Facility string
The facility where the device is deployed

Deprecated: Use metro instead of facility. For more information, read the migration guide: https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/migration_guide_facilities_to_metros_devices

HardwareReservationId string
The id of hardware reservation which this device occupies
Hostname string
The device name
Id string
The provider-assigned unique ID for this managed resource.
IpxeScriptUrl string
Metro string
The metro where the device is deployed
NetworkType string
L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
Networks List<GetDeviceNetwork>
The device's private and public IP (v4 and v6) network details. When a device is run without any special network configuration, it will have 3 networks: ublic IPv4 at equinixmetaldevice.name.network.0, IPv6 at equinixmetaldevice.name.network.1 and private IPv4 at equinixmetaldevice.name.network.2. Elastic addresses then stack by type - an assigned public IPv4 will go after the management public IPv4 (to index 1), and will then shift the indices of the IPv6 and private IPv4. Assigned private IPv4 will go after the management private IPv4 (to the end of the network list).
OperatingSystem string
The operating system running on the device
Plan string
The hardware config of the device
Ports List<GetDevicePort>
Ports assigned to the device
ProjectId string
The id of the project in which the devices exists
RootPassword string
Root password to the server (if still available)
SosHostname string
The hostname to use for Serial over SSH access to the device
SshKeyIds List<string>
List of IDs of SSH keys deployed in the device, can be both user or project SSH keys
State string
The state of the device
Storage string
Tags List<string>
Tags attached to the device
AccessPrivateIpv4 string
The ipv4 private IP assigned to the device
AccessPublicIpv4 string
The ipv4 management IP assigned to the device
AccessPublicIpv6 string
The ipv6 management IP assigned to the device
AlwaysPxe bool
BillingCycle string
The billing cycle of the device (monthly or hourly)
Description string
Description string for the device
DeviceId string
Device ID
Facility string
The facility where the device is deployed

Deprecated: Use metro instead of facility. For more information, read the migration guide: https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/migration_guide_facilities_to_metros_devices

HardwareReservationId string
The id of hardware reservation which this device occupies
Hostname string
The device name
Id string
The provider-assigned unique ID for this managed resource.
IpxeScriptUrl string
Metro string
The metro where the device is deployed
NetworkType string
L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
Networks []GetDeviceNetwork
The device's private and public IP (v4 and v6) network details. When a device is run without any special network configuration, it will have 3 networks: ublic IPv4 at equinixmetaldevice.name.network.0, IPv6 at equinixmetaldevice.name.network.1 and private IPv4 at equinixmetaldevice.name.network.2. Elastic addresses then stack by type - an assigned public IPv4 will go after the management public IPv4 (to index 1), and will then shift the indices of the IPv6 and private IPv4. Assigned private IPv4 will go after the management private IPv4 (to the end of the network list).
OperatingSystem string
The operating system running on the device
Plan string
The hardware config of the device
Ports []GetDevicePort
Ports assigned to the device
ProjectId string
The id of the project in which the devices exists
RootPassword string
Root password to the server (if still available)
SosHostname string
The hostname to use for Serial over SSH access to the device
SshKeyIds []string
List of IDs of SSH keys deployed in the device, can be both user or project SSH keys
State string
The state of the device
Storage string
Tags []string
Tags attached to the device
accessPrivateIpv4 String
The ipv4 private IP assigned to the device
accessPublicIpv4 String
The ipv4 management IP assigned to the device
accessPublicIpv6 String
The ipv6 management IP assigned to the device
alwaysPxe Boolean
billingCycle String
The billing cycle of the device (monthly or hourly)
description String
Description string for the device
deviceId String
Device ID
facility String
The facility where the device is deployed

Deprecated: Use metro instead of facility. For more information, read the migration guide: https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/migration_guide_facilities_to_metros_devices

hardwareReservationId String
The id of hardware reservation which this device occupies
hostname String
The device name
id String
The provider-assigned unique ID for this managed resource.
ipxeScriptUrl String
metro String
The metro where the device is deployed
networkType String
L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
networks List<GetDeviceNetwork>
The device's private and public IP (v4 and v6) network details. When a device is run without any special network configuration, it will have 3 networks: ublic IPv4 at equinixmetaldevice.name.network.0, IPv6 at equinixmetaldevice.name.network.1 and private IPv4 at equinixmetaldevice.name.network.2. Elastic addresses then stack by type - an assigned public IPv4 will go after the management public IPv4 (to index 1), and will then shift the indices of the IPv6 and private IPv4. Assigned private IPv4 will go after the management private IPv4 (to the end of the network list).
operatingSystem String
The operating system running on the device
plan String
The hardware config of the device
ports List<GetDevicePort>
Ports assigned to the device
projectId String
The id of the project in which the devices exists
rootPassword String
Root password to the server (if still available)
sosHostname String
The hostname to use for Serial over SSH access to the device
sshKeyIds List<String>
List of IDs of SSH keys deployed in the device, can be both user or project SSH keys
state String
The state of the device
storage String
tags List<String>
Tags attached to the device
accessPrivateIpv4 string
The ipv4 private IP assigned to the device
accessPublicIpv4 string
The ipv4 management IP assigned to the device
accessPublicIpv6 string
The ipv6 management IP assigned to the device
alwaysPxe boolean
billingCycle string
The billing cycle of the device (monthly or hourly)
description string
Description string for the device
deviceId string
Device ID
facility string
The facility where the device is deployed

Deprecated: Use metro instead of facility. For more information, read the migration guide: https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/migration_guide_facilities_to_metros_devices

hardwareReservationId string
The id of hardware reservation which this device occupies
hostname string
The device name
id string
The provider-assigned unique ID for this managed resource.
ipxeScriptUrl string
metro string
The metro where the device is deployed
networkType string
L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
networks GetDeviceNetwork[]
The device's private and public IP (v4 and v6) network details. When a device is run without any special network configuration, it will have 3 networks: ublic IPv4 at equinixmetaldevice.name.network.0, IPv6 at equinixmetaldevice.name.network.1 and private IPv4 at equinixmetaldevice.name.network.2. Elastic addresses then stack by type - an assigned public IPv4 will go after the management public IPv4 (to index 1), and will then shift the indices of the IPv6 and private IPv4. Assigned private IPv4 will go after the management private IPv4 (to the end of the network list).
operatingSystem string
The operating system running on the device
plan string
The hardware config of the device
ports GetDevicePort[]
Ports assigned to the device
projectId string
The id of the project in which the devices exists
rootPassword string
Root password to the server (if still available)
sosHostname string
The hostname to use for Serial over SSH access to the device
sshKeyIds string[]
List of IDs of SSH keys deployed in the device, can be both user or project SSH keys
state string
The state of the device
storage string
tags string[]
Tags attached to the device
access_private_ipv4 str
The ipv4 private IP assigned to the device
access_public_ipv4 str
The ipv4 management IP assigned to the device
access_public_ipv6 str
The ipv6 management IP assigned to the device
always_pxe bool
billing_cycle str
The billing cycle of the device (monthly or hourly)
description str
Description string for the device
device_id str
Device ID
facility str
The facility where the device is deployed

Deprecated: Use metro instead of facility. For more information, read the migration guide: https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/migration_guide_facilities_to_metros_devices

hardware_reservation_id str
The id of hardware reservation which this device occupies
hostname str
The device name
id str
The provider-assigned unique ID for this managed resource.
ipxe_script_url str
metro str
The metro where the device is deployed
network_type str
L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
networks Sequence[GetDeviceNetwork]
The device's private and public IP (v4 and v6) network details. When a device is run without any special network configuration, it will have 3 networks: ublic IPv4 at equinixmetaldevice.name.network.0, IPv6 at equinixmetaldevice.name.network.1 and private IPv4 at equinixmetaldevice.name.network.2. Elastic addresses then stack by type - an assigned public IPv4 will go after the management public IPv4 (to index 1), and will then shift the indices of the IPv6 and private IPv4. Assigned private IPv4 will go after the management private IPv4 (to the end of the network list).
operating_system str
The operating system running on the device
plan str
The hardware config of the device
ports Sequence[GetDevicePort]
Ports assigned to the device
project_id str
The id of the project in which the devices exists
root_password str
Root password to the server (if still available)
sos_hostname str
The hostname to use for Serial over SSH access to the device
ssh_key_ids Sequence[str]
List of IDs of SSH keys deployed in the device, can be both user or project SSH keys
state str
The state of the device
storage str
tags Sequence[str]
Tags attached to the device
accessPrivateIpv4 String
The ipv4 private IP assigned to the device
accessPublicIpv4 String
The ipv4 management IP assigned to the device
accessPublicIpv6 String
The ipv6 management IP assigned to the device
alwaysPxe Boolean
billingCycle String
The billing cycle of the device (monthly or hourly)
description String
Description string for the device
deviceId String
Device ID
facility String
The facility where the device is deployed

Deprecated: Use metro instead of facility. For more information, read the migration guide: https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/migration_guide_facilities_to_metros_devices

hardwareReservationId String
The id of hardware reservation which this device occupies
hostname String
The device name
id String
The provider-assigned unique ID for this managed resource.
ipxeScriptUrl String
metro String
The metro where the device is deployed
networkType String
L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
networks List<Property Map>
The device's private and public IP (v4 and v6) network details. When a device is run without any special network configuration, it will have 3 networks: ublic IPv4 at equinixmetaldevice.name.network.0, IPv6 at equinixmetaldevice.name.network.1 and private IPv4 at equinixmetaldevice.name.network.2. Elastic addresses then stack by type - an assigned public IPv4 will go after the management public IPv4 (to index 1), and will then shift the indices of the IPv6 and private IPv4. Assigned private IPv4 will go after the management private IPv4 (to the end of the network list).
operatingSystem String
The operating system running on the device
plan String
The hardware config of the device
ports List<Property Map>
Ports assigned to the device
projectId String
The id of the project in which the devices exists
rootPassword String
Root password to the server (if still available)
sosHostname String
The hostname to use for Serial over SSH access to the device
sshKeyIds List<String>
List of IDs of SSH keys deployed in the device, can be both user or project SSH keys
state String
The state of the device
storage String
tags List<String>
Tags attached to the device

Supporting Types

GetDeviceNetwork

Address This property is required. string
IPv4 or IPv6 address string
Cidr This property is required. int
Bit length of the network mask of the address
Family This property is required. int
IP version - "4" or "6"
Gateway This property is required. string
Address of router
Public This property is required. bool
Whether the address is routable from the Internet
Address This property is required. string
IPv4 or IPv6 address string
Cidr This property is required. int
Bit length of the network mask of the address
Family This property is required. int
IP version - "4" or "6"
Gateway This property is required. string
Address of router
Public This property is required. bool
Whether the address is routable from the Internet
address This property is required. String
IPv4 or IPv6 address string
cidr This property is required. Integer
Bit length of the network mask of the address
family This property is required. Integer
IP version - "4" or "6"
gateway This property is required. String
Address of router
public_ This property is required. Boolean
Whether the address is routable from the Internet
address This property is required. string
IPv4 or IPv6 address string
cidr This property is required. number
Bit length of the network mask of the address
family This property is required. number
IP version - "4" or "6"
gateway This property is required. string
Address of router
public This property is required. boolean
Whether the address is routable from the Internet
address This property is required. str
IPv4 or IPv6 address string
cidr This property is required. int
Bit length of the network mask of the address
family This property is required. int
IP version - "4" or "6"
gateway This property is required. str
Address of router
public This property is required. bool
Whether the address is routable from the Internet
address This property is required. String
IPv4 or IPv6 address string
cidr This property is required. Number
Bit length of the network mask of the address
family This property is required. Number
IP version - "4" or "6"
gateway This property is required. String
Address of router
public This property is required. Boolean
Whether the address is routable from the Internet

GetDevicePort

Bonded This property is required. bool
Whether this port is part of a bond in bonded network setup
Id This property is required. string
The ID of the device
Mac This property is required. string
MAC address assigned to the port
Name This property is required. string
Name of the port (e.g. eth0, or bond0)
Type This property is required. string
Type of the port (e.g. NetworkPort or NetworkBondPort)
Bonded This property is required. bool
Whether this port is part of a bond in bonded network setup
Id This property is required. string
The ID of the device
Mac This property is required. string
MAC address assigned to the port
Name This property is required. string
Name of the port (e.g. eth0, or bond0)
Type This property is required. string
Type of the port (e.g. NetworkPort or NetworkBondPort)
bonded This property is required. Boolean
Whether this port is part of a bond in bonded network setup
id This property is required. String
The ID of the device
mac This property is required. String
MAC address assigned to the port
name This property is required. String
Name of the port (e.g. eth0, or bond0)
type This property is required. String
Type of the port (e.g. NetworkPort or NetworkBondPort)
bonded This property is required. boolean
Whether this port is part of a bond in bonded network setup
id This property is required. string
The ID of the device
mac This property is required. string
MAC address assigned to the port
name This property is required. string
Name of the port (e.g. eth0, or bond0)
type This property is required. string
Type of the port (e.g. NetworkPort or NetworkBondPort)
bonded This property is required. bool
Whether this port is part of a bond in bonded network setup
id This property is required. str
The ID of the device
mac This property is required. str
MAC address assigned to the port
name This property is required. str
Name of the port (e.g. eth0, or bond0)
type This property is required. str
Type of the port (e.g. NetworkPort or NetworkBondPort)
bonded This property is required. Boolean
Whether this port is part of a bond in bonded network setup
id This property is required. String
The ID of the device
mac This property is required. String
MAC address assigned to the port
name This property is required. String
Name of the port (e.g. eth0, or bond0)
type This property is required. String
Type of the port (e.g. NetworkPort or NetworkBondPort)

Package Details

Repository
equinix equinix/pulumi-equinix
License
Apache-2.0
Notes
This Pulumi package is based on the equinix Terraform Provider.
Equinix v0.21.0 published on Friday, Feb 28, 2025 by Equinix