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_password
anduser_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:
- device_
id str Device ID.
NOTE: You should pass either
device_id
, or bothproject_id
andhostname
.- 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:
- Access
Private stringIpv4 - The ipv4 private IP assigned to the device.
- Access
Public stringIpv4 - The ipv4 management IP assigned to the device.
- Access
Public stringIpv6 - The ipv6 management IP assigned to the device.
- Always
Pxe bool - Billing
Cycle string - The billing cycle of the device (monthly or hourly).
- Description string
- Description string for the device.
- Device
Id string - Facility string
- (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide
- Hardware
Reservation stringId - The id of hardware reservation which this device occupies.
- Hostname string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipxe
Script stringUrl - Metro string
- The metro where the device is deployed
- Network
Type string - L2 network type of the device, one of
layer3
,layer2-bonded
,layer2-individual
,hybrid
. - Networks
List<Get
Device Network> - The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
- Operating
System string - The operating system running on the device.
- Plan string
- The hardware config of the device.
- Ports
List<Get
Device Port> - List of ports assigned to the device. See Ports Attribute below for more details.
- Project
Id string - Root
Password string - Root password to the server (if still available).
- Sos
Hostname string - The hostname to use for Serial over SSH access to the device
- Ssh
Key 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.
- Access
Private stringIpv4 - The ipv4 private IP assigned to the device.
- Access
Public stringIpv4 - The ipv4 management IP assigned to the device.
- Access
Public stringIpv6 - The ipv6 management IP assigned to the device.
- Always
Pxe bool - Billing
Cycle string - The billing cycle of the device (monthly or hourly).
- Description string
- Description string for the device.
- Device
Id string - Facility string
- (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide
- Hardware
Reservation stringId - The id of hardware reservation which this device occupies.
- Hostname string
- Id string
- The provider-assigned unique ID for this managed resource.
- Ipxe
Script stringUrl - Metro string
- The metro where the device is deployed
- Network
Type string - L2 network type of the device, one of
layer3
,layer2-bonded
,layer2-individual
,hybrid
. - Networks
[]Get
Device Network - The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
- Operating
System string - The operating system running on the device.
- Plan string
- The hardware config of the device.
- Ports
[]Get
Device Port - List of ports assigned to the device. See Ports Attribute below for more details.
- Project
Id string - Root
Password string - Root password to the server (if still available).
- Sos
Hostname string - The hostname to use for Serial over SSH access to the device
- Ssh
Key []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.
- access
Private StringIpv4 - The ipv4 private IP assigned to the device.
- access
Public StringIpv4 - The ipv4 management IP assigned to the device.
- access
Public StringIpv6 - The ipv6 management IP assigned to the device.
- always
Pxe Boolean - billing
Cycle String - The billing cycle of the device (monthly or hourly).
- description String
- Description string for the device.
- device
Id String - facility String
- (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide
- hardware
Reservation StringId - The id of hardware reservation which this device occupies.
- hostname String
- id String
- The provider-assigned unique ID for this managed resource.
- ipxe
Script StringUrl - metro String
- The metro where the device is deployed
- network
Type String - L2 network type of the device, one of
layer3
,layer2-bonded
,layer2-individual
,hybrid
. - networks
List<Get
Device Network> - The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
- operating
System String - The operating system running on the device.
- plan String
- The hardware config of the device.
- ports
List<Get
Device Port> - List of ports assigned to the device. See Ports Attribute below for more details.
- project
Id String - root
Password String - Root password to the server (if still available).
- sos
Hostname String - The hostname to use for Serial over SSH access to the device
- ssh
Key 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.
- access
Private stringIpv4 - The ipv4 private IP assigned to the device.
- access
Public stringIpv4 - The ipv4 management IP assigned to the device.
- access
Public stringIpv6 - The ipv6 management IP assigned to the device.
- always
Pxe boolean - billing
Cycle string - The billing cycle of the device (monthly or hourly).
- description string
- Description string for the device.
- device
Id string - facility string
- (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide
- hardware
Reservation stringId - The id of hardware reservation which this device occupies.
- hostname string
- id string
- The provider-assigned unique ID for this managed resource.
- ipxe
Script stringUrl - metro string
- The metro where the device is deployed
- network
Type string - L2 network type of the device, one of
layer3
,layer2-bonded
,layer2-individual
,hybrid
. - networks
Get
Device Network[] - The device's private and public IP (v4 and v6) network details. See Network Attribute below for more details.
- operating
System string - The operating system running on the device.
- plan string
- The hardware config of the device.
- ports
Get
Device Port[] - List of ports assigned to the device. See Ports Attribute below for more details.
- project
Id string - root
Password string - Root password to the server (if still available).
- sos
Hostname string - The hostname to use for Serial over SSH access to the device
- ssh
Key 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 - facility str
- (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide
- hardware_
reservation_ strid - The id of hardware reservation which this device occupies.
- hostname str
- 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 of
layer3
,layer2-bonded
,layer2-individual
,hybrid
. - networks
Sequence[Get
Device Network] - 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[Get
Device Port] - 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_ 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.
- access
Private StringIpv4 - The ipv4 private IP assigned to the device.
- access
Public StringIpv4 - The ipv4 management IP assigned to the device.
- access
Public StringIpv6 - The ipv6 management IP assigned to the device.
- always
Pxe Boolean - billing
Cycle String - The billing cycle of the device (monthly or hourly).
- description String
- Description string for the device.
- device
Id String - facility String
- (Deprecated) The facility where the device is deployed. Use metro instead; read the facility to metro migration guide
- hardware
Reservation StringId - The id of hardware reservation which this device occupies.
- hostname String
- id String
- The provider-assigned unique ID for this managed resource.
- ipxe
Script StringUrl - metro String
- The metro where the device is deployed
- network
Type 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.
- operating
System 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.
- project
Id String - root
Password String - Root password to the server (if still available).
- sos
Hostname String - The hostname to use for Serial over SSH access to the device
- ssh
Key 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
equinix
Terraform Provider.