1. Packages
  2. Equinix
  3. API Docs
  4. metal
  5. getDevice
Equinix v0.8.0 published on Tuesday, Apr 2, 2024 by Equinix

equinix.metal.getDevice

Explore with Pulumi AI

equinix logo
Equinix v0.8.0 published on Tuesday, Apr 2, 2024 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);
    
    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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: equinix:metal/getDevice:getDevice
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DeviceId string

    Device ID.

    NOTE: You should pass either device_id, or both project_id and hostname.

    Hostname string
    The device name.
    ProjectId string
    The id of the project in which the devices exists.
    DeviceId string

    Device ID.

    NOTE: You should pass either device_id, or both project_id and hostname.

    Hostname string
    The device name.
    ProjectId string
    The id of the project in which the devices exists.
    deviceId String

    Device ID.

    NOTE: You should pass either device_id, or both project_id and hostname.

    hostname String
    The device name.
    projectId String
    The id of the project in which the devices exists.
    deviceId string

    Device ID.

    NOTE: You should pass either device_id, or both project_id and hostname.

    hostname string
    The device name.
    projectId string
    The id of the project in which the devices exists.
    device_id str

    Device ID.

    NOTE: You should pass either device_id, or both project_id and hostname.

    hostname str
    The device name.
    project_id str
    The id of the project in which the devices exists.
    deviceId String

    Device ID.

    NOTE: You should pass either device_id, or both project_id and hostname.

    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
    Facility string
    (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide

    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
    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 of layer3, layer2-bonded, layer2-individual, hybrid.
    Networks List<GetDeviceNetwork>
    The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
    OperatingSystem string
    The operating system running on the device.
    Plan string
    The hardware config of the device.
    Ports List<GetDevicePort>
    List of ports assigned to the device. See Ports Attribute below for more details.
    ProjectId string
    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
    Facility string
    (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide

    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
    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 of layer3, layer2-bonded, layer2-individual, hybrid.
    Networks []GetDeviceNetwork
    The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
    OperatingSystem string
    The operating system running on the device.
    Plan string
    The hardware config of the device.
    Ports []GetDevicePort
    List of ports assigned to the device. See Ports Attribute below for more details.
    ProjectId string
    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
    facility String
    (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide

    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
    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 of layer3, layer2-bonded, layer2-individual, hybrid.
    networks List<GetDeviceNetwork>
    The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
    operatingSystem String
    The operating system running on the device.
    plan String
    The hardware config of the device.
    ports List<GetDevicePort>
    List of ports assigned to the device. See Ports Attribute below for more details.
    projectId String
    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
    facility string
    (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide

    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
    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 of layer3, layer2-bonded, layer2-individual, hybrid.
    networks GetDeviceNetwork[]
    The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
    operatingSystem string
    The operating system running on the device.
    plan string
    The hardware config of the device.
    ports GetDevicePort[]
    List of ports assigned to the device. See Ports Attribute below for more details.
    projectId string
    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
    facility str
    (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide

    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
    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 of layer3, layer2-bonded, layer2-individual, hybrid.
    networks Sequence[GetDeviceNetwork]
    The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
    operating_system str
    The operating system running on the device.
    plan str
    The hardware config of the device.
    ports Sequence[GetDevicePort]
    List of ports assigned to the device. See Ports Attribute below for more details.
    project_id str
    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
    facility String
    (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide

    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
    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 of layer3, layer2-bonded, layer2-individual, hybrid.
    networks List<Property Map>
    The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
    operatingSystem String
    The operating system running on the device.
    plan String
    The hardware config of the device.
    ports List<Property Map>
    List of ports assigned to the device. See Ports Attribute below for more details.
    projectId String
    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 string
    IPv4 or IPv6 address string.
    Cidr int
    Bit length of the network mask of the address.
    Family int
    IP version. One of 4, 6.
    Gateway string
    Address of router.
    Public bool
    Whether the address is routable from the Internet.
    Address string
    IPv4 or IPv6 address string.
    Cidr int
    Bit length of the network mask of the address.
    Family int
    IP version. One of 4, 6.
    Gateway string
    Address of router.
    Public bool
    Whether the address is routable from the Internet.
    address String
    IPv4 or IPv6 address string.
    cidr Integer
    Bit length of the network mask of the address.
    family Integer
    IP version. One of 4, 6.
    gateway String
    Address of router.
    public_ Boolean
    Whether the address is routable from the Internet.
    address string
    IPv4 or IPv6 address string.
    cidr number
    Bit length of the network mask of the address.
    family number
    IP version. One of 4, 6.
    gateway string
    Address of router.
    public boolean
    Whether the address is routable from the Internet.
    address str
    IPv4 or IPv6 address string.
    cidr int
    Bit length of the network mask of the address.
    family int
    IP version. One of 4, 6.
    gateway str
    Address of router.
    public bool
    Whether the address is routable from the Internet.
    address String
    IPv4 or IPv6 address string.
    cidr Number
    Bit length of the network mask of the address.
    family Number
    IP version. One of 4, 6.
    gateway String
    Address of router.
    public Boolean
    Whether the address is routable from the Internet.

    GetDevicePort

    Bonded bool
    Whether this port is part of a bond in bonded network setup.
    Id string
    ID of the port.
    Mac string
    MAC address assigned to the port.
    Name string
    Name of the port (e.g. eth0, or bond0).
    Type string
    Type of the port (e.g. NetworkPort or NetworkBondPort).
    Bonded bool
    Whether this port is part of a bond in bonded network setup.
    Id string
    ID of the port.
    Mac string
    MAC address assigned to the port.
    Name string
    Name of the port (e.g. eth0, or bond0).
    Type string
    Type of the port (e.g. NetworkPort or NetworkBondPort).
    bonded Boolean
    Whether this port is part of a bond in bonded network setup.
    id String
    ID of the port.
    mac String
    MAC address assigned to the port.
    name String
    Name of the port (e.g. eth0, or bond0).
    type String
    Type of the port (e.g. NetworkPort or NetworkBondPort).
    bonded boolean
    Whether this port is part of a bond in bonded network setup.
    id string
    ID of the port.
    mac string
    MAC address assigned to the port.
    name string
    Name of the port (e.g. eth0, or bond0).
    type string
    Type of the port (e.g. NetworkPort or NetworkBondPort).
    bonded bool
    Whether this port is part of a bond in bonded network setup.
    id str
    ID of the port.
    mac str
    MAC address assigned to the port.
    name str
    Name of the port (e.g. eth0, or bond0).
    type str
    Type of the port (e.g. NetworkPort or NetworkBondPort).
    bonded Boolean
    Whether this port is part of a bond in bonded network setup.
    id String
    ID of the port.
    mac String
    MAC address assigned to the port.
    name String
    Name of the port (e.g. eth0, or bond0).
    type 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 logo
    Equinix v0.8.0 published on Tuesday, Apr 2, 2024 by Equinix