Equinix v0.19.0 published on Thursday, Oct 24, 2024 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_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
- 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 - Device ID
- Facility string
- The facility where the device is deployed
- Hardware
Reservation 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.
- Ipxe
Script stringUrl - Metro string
- The metro where the device is deployed
- Network
Type string - L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
- Networks
List<Get
Device 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 string - The operating system running on the device
- Plan string
- The hardware config of the device
- Ports
List<Get
Device Port> - Ports assigned to the device
- Project
Id string - The id of the project in which the devices exists
- 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 - Device ID
- Facility string
- The facility where the device is deployed
- Hardware
Reservation 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.
- Ipxe
Script stringUrl - Metro string
- The metro where the device is deployed
- Network
Type string - L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
- Networks
[]Get
Device 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 string - The operating system running on the device
- Plan string
- The hardware config of the device
- Ports
[]Get
Device Port - Ports assigned to the device
- Project
Id string - The id of the project in which the devices exists
- 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 - Device ID
- facility String
- The facility where the device is deployed
- hardware
Reservation 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.
- ipxe
Script StringUrl - metro String
- The metro where the device is deployed
- network
Type String - L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
- networks
List<Get
Device 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 String - The operating system running on the device
- plan String
- The hardware config of the device
- ports
List<Get
Device Port> - Ports assigned to the device
- project
Id String - The id of the project in which the devices exists
- 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 - Device ID
- facility string
- The facility where the device is deployed
- hardware
Reservation 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.
- ipxe
Script stringUrl - metro string
- The metro where the device is deployed
- network
Type string - L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
- networks
Get
Device 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 string - The operating system running on the device
- plan string
- The hardware config of the device
- ports
Get
Device Port[] - Ports assigned to the device
- project
Id string - The id of the project in which the devices exists
- 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 - 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[Get
Device 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[Get
Device 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
- 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 - Device ID
- facility String
- The facility where the device is deployed
- hardware
Reservation 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.
- ipxe
Script StringUrl - metro String
- The metro where the device is deployed
- network
Type 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).
- operating
System 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
- project
Id String - The id of the project in which the devices exists
- 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.