Equinix v0.22.0 published on Wednesday, Apr 23, 2025 by Equinix
equinix.metal.getDevice
Explore with Pulumi AI
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_passwordanduser_datawill 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);
import pulumi
import pulumi_equinix as equinix
test = equinix.metal.get_device(project_id=local["project_id"],
    hostname="mydevice")
pulumi.export("id", test.id)
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
	})
}
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),
    };
});
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()));
    }
}
variables:
  test:
    fn::invoke:
      function: equinix:metal:getDevice
      arguments:
        projectId: ${local.project_id}
        hostname: mydevice
outputs:
  id: ${test.id}
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);
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)
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
	})
}
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),
    };
});
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()));
    }
}
variables:
  test:
    fn::invoke:
      function: equinix:metal:getDevice
      arguments:
        deviceId: 4c641195-25e5-4c3c-b2b7-4cd7a42c7b40
outputs:
  ipv4: ${test.accessPublicIpv4}
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>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]func LookupDevice(ctx *Context, args *LookupDeviceArgs, opts ...InvokeOption) (*LookupDeviceResult, error)
func LookupDeviceOutput(ctx *Context, args *LookupDeviceOutputArgs, opts ...InvokeOption) LookupDeviceResultOutput> 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)
}public static CompletableFuture<GetDeviceResult> getDevice(GetDeviceArgs args, InvokeOptions options)
public static Output<GetDeviceResult> getDevice(GetDeviceArgs args, InvokeOptions options)
fn::invoke:
  function: equinix:metal/getDevice:getDevice
  arguments:
    # arguments dictionaryThe following arguments are supported:
- device_id str
- Device ID
- hostname str
- The device name
- project_id str
- The id of the project in which the devices exists
getDevice Result
The following output properties are available:
- AccessPrivate stringIpv4 
- The ipv4 private IP assigned to the device
- AccessPublic stringIpv4 
- The ipv4 management IP assigned to the device
- AccessPublic stringIpv6 
- 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
- HardwareReservation stringId 
- 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.
- IpxeScript stringUrl 
- 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<GetDevice Network> 
- 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<GetDevice Port> 
- 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
- SshKey List<string>Ids 
- 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
- List<string>
- Tags attached to the device
- AccessPrivate stringIpv4 
- The ipv4 private IP assigned to the device
- AccessPublic stringIpv4 
- The ipv4 management IP assigned to the device
- AccessPublic stringIpv6 
- 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
- HardwareReservation stringId 
- 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.
- IpxeScript stringUrl 
- 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
[]GetDevice Network 
- 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
[]GetDevice Port 
- 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
- SshKey []stringIds 
- 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
- []string
- Tags attached to the device
- accessPrivate StringIpv4 
- The ipv4 private IP assigned to the device
- accessPublic StringIpv4 
- The ipv4 management IP assigned to the device
- accessPublic StringIpv6 
- 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
- hardwareReservation StringId 
- 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.
- ipxeScript StringUrl 
- 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<GetDevice Network> 
- 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<GetDevice Port> 
- 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
- sshKey List<String>Ids 
- 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
- List<String>
- Tags attached to the device
- accessPrivate stringIpv4 
- The ipv4 private IP assigned to the device
- accessPublic stringIpv4 
- The ipv4 management IP assigned to the device
- accessPublic stringIpv6 
- 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
- hardwareReservation stringId 
- 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.
- ipxeScript stringUrl 
- 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
GetDevice Network[] 
- 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
GetDevice Port[] 
- 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
- sshKey string[]Ids 
- 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
- string[]
- Tags attached to the device
- access_private_ stripv4 
- The ipv4 private IP assigned to the device
- access_public_ stripv4 
- The ipv4 management IP assigned to the device
- access_public_ stripv6 
- 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
- hardware_reservation_ strid 
- 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_ strurl 
- 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[GetDevice Network] 
- 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[GetDevice Port] 
- 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_ Sequence[str]ids 
- 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
- Sequence[str]
- Tags attached to the device
- accessPrivate StringIpv4 
- The ipv4 private IP assigned to the device
- accessPublic StringIpv4 
- The ipv4 management IP assigned to the device
- accessPublic StringIpv6 
- 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
- hardwareReservation StringId 
- 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.
- ipxeScript StringUrl 
- 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
- sshKey List<String>Ids 
- 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
- List<String>
- Tags attached to the device
Supporting Types
GetDeviceNetwork  
GetDevicePort  
Package Details
- Repository
- equinix equinix/pulumi-equinix
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the equinixTerraform Provider.
