Equinix v0.11.2 published on Wednesday, Jun 26, 2024 by Equinix
equinix.metal.getPort
Explore with Pulumi AI
Use this data source to read ports of existing devices. You can read port by either its UUID, or by a device UUID and port name.
Example Usage
Create a device and read it’s eth0 port to the datasource.
import * as pulumi from "@pulumi/pulumi";
import * as equinix from "@equinix-labs/pulumi-equinix";
import * as equinix from "@pulumi/equinix";
const projectId = "<UUID_of_your_project>";
const testDevice = new equinix.metal.Device("testDevice", {
hostname: "tfacc-test-device-port",
plan: equinix.metal.Plan.C3MediumX86,
metro: "sv",
operatingSystem: equinix.metal.OperatingSystem.Ubuntu20_04,
billingCycle: equinix.metal.BillingCycle.Hourly,
projectId: projectId,
});
const testPort = equinix.metal.getPortOutput({
deviceId: testDevice.id,
name: "eth0",
});
import pulumi
import pulumi_equinix as equinix
project_id = "<UUID_of_your_project>"
test_device = equinix.metal.Device("testDevice",
hostname="tfacc-test-device-port",
plan=equinix.metal.Plan.C3_MEDIUM_X86,
metro="sv",
operating_system=equinix.metal.OperatingSystem.UBUNTU20_04,
billing_cycle=equinix.metal.BillingCycle.HOURLY,
project_id=project_id)
test_port = equinix.metal.get_port_output(device_id=test_device.id,
name="eth0")
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 {
projectId := "<UUID_of_your_project>"
testDevice, err := metal.NewDevice(ctx, "testDevice", &metal.DeviceArgs{
Hostname: pulumi.String("tfacc-test-device-port"),
Plan: pulumi.String(metal.PlanC3MediumX86),
Metro: pulumi.String("sv"),
OperatingSystem: pulumi.String(metal.OperatingSystem_Ubuntu20_04),
BillingCycle: pulumi.String(metal.BillingCycleHourly),
ProjectId: pulumi.String(projectId),
})
if err != nil {
return err
}
_ = metal.LookupPortOutput(ctx, metal.GetPortOutputArgs{
DeviceId: testDevice.ID(),
Name: pulumi.String("eth0"),
}, nil)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Equinix = Pulumi.Equinix;
return await Deployment.RunAsync(() =>
{
var projectId = "<UUID_of_your_project>";
var testDevice = new Equinix.Metal.Device("testDevice", new()
{
Hostname = "tfacc-test-device-port",
Plan = Equinix.Metal.Plan.C3MediumX86,
Metro = "sv",
OperatingSystem = Equinix.Metal.OperatingSystem.Ubuntu20_04,
BillingCycle = Equinix.Metal.BillingCycle.Hourly,
ProjectId = projectId,
});
var testPort = Equinix.Metal.GetPort.Invoke(new()
{
DeviceId = testDevice.Id,
Name = "eth0",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.equinix.metal.Device;
import com.pulumi.equinix.metal.DeviceArgs;
import com.pulumi.equinix.metal.MetalFunctions;
import com.pulumi.equinix.metal.inputs.GetPortArgs;
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 projectId = "<UUID_of_your_project>";
var testDevice = new Device("testDevice", DeviceArgs.builder()
.hostname("tfacc-test-device-port")
.plan("c3.medium.x86")
.metro("sv")
.operatingSystem("ubuntu_20_04")
.billingCycle("hourly")
.projectId(projectId)
.build());
final var testPort = MetalFunctions.getPort(GetPortArgs.builder()
.deviceId(testDevice.id())
.name("eth0")
.build());
}
}
resources:
testDevice:
type: equinix:metal:Device
properties:
hostname: tfacc-test-device-port
plan: c3.medium.x86
metro: sv
operatingSystem: ubuntu_20_04
billingCycle: hourly
projectId: ${projectId}
variables:
projectId: <UUID_of_your_project>
testPort:
fn::invoke:
Function: equinix:metal:getPort
Arguments:
deviceId: ${testDevice.id}
name: eth0
Using getPort
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 getPort(args: GetPortArgs, opts?: InvokeOptions): Promise<GetPortResult>
function getPortOutput(args: GetPortOutputArgs, opts?: InvokeOptions): Output<GetPortResult>
def get_port(device_id: Optional[str] = None,
name: Optional[str] = None,
port_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPortResult
def get_port_output(device_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
port_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPortResult]
func LookupPort(ctx *Context, args *LookupPortArgs, opts ...InvokeOption) (*LookupPortResult, error)
func LookupPortOutput(ctx *Context, args *LookupPortOutputArgs, opts ...InvokeOption) LookupPortResultOutput
> Note: This function is named LookupPort
in the Go SDK.
public static class GetPort
{
public static Task<GetPortResult> InvokeAsync(GetPortArgs args, InvokeOptions? opts = null)
public static Output<GetPortResult> Invoke(GetPortInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPortResult> getPort(GetPortArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: equinix:metal/getPort:getPort
arguments:
# arguments dictionary
The following arguments are supported:
getPort Result
The following output properties are available:
- Bond
Id string - UUID of the bond port.
- Bond
Name string - Name of the bond port.
- Bonded bool
- Flag indicating whether the port is bonded.
- Disbond
Supported bool - Flag indicating whether the port can be removed from a bond.
- Id string
- The provider-assigned unique ID for this managed resource.
- Layer2 bool
- Mac string
- MAC address of the port.
- Name string
- Native
Vlan stringId - UUID of native VLAN of the port.
- Network
Type string - One of
layer2-bonded
,layer2-individual
,layer3
,hybrid
,hybrid-bonded
. - Type string
- Type is either
NetworkBondPort
for bond ports orNetworkPort
for bondable ethernet ports. - Vlan
Ids List<string> - UUIDs of attached VLANs.
- Vxlan
Ids List<int> - VXLAN ids of attached VLANs.
- Device
Id string - Port
Id string
- Bond
Id string - UUID of the bond port.
- Bond
Name string - Name of the bond port.
- Bonded bool
- Flag indicating whether the port is bonded.
- Disbond
Supported bool - Flag indicating whether the port can be removed from a bond.
- Id string
- The provider-assigned unique ID for this managed resource.
- Layer2 bool
- Mac string
- MAC address of the port.
- Name string
- Native
Vlan stringId - UUID of native VLAN of the port.
- Network
Type string - One of
layer2-bonded
,layer2-individual
,layer3
,hybrid
,hybrid-bonded
. - Type string
- Type is either
NetworkBondPort
for bond ports orNetworkPort
for bondable ethernet ports. - Vlan
Ids []string - UUIDs of attached VLANs.
- Vxlan
Ids []int - VXLAN ids of attached VLANs.
- Device
Id string - Port
Id string
- bond
Id String - UUID of the bond port.
- bond
Name String - Name of the bond port.
- bonded Boolean
- Flag indicating whether the port is bonded.
- disbond
Supported Boolean - Flag indicating whether the port can be removed from a bond.
- id String
- The provider-assigned unique ID for this managed resource.
- layer2 Boolean
- mac String
- MAC address of the port.
- name String
- native
Vlan StringId - UUID of native VLAN of the port.
- network
Type String - One of
layer2-bonded
,layer2-individual
,layer3
,hybrid
,hybrid-bonded
. - type String
- Type is either
NetworkBondPort
for bond ports orNetworkPort
for bondable ethernet ports. - vlan
Ids List<String> - UUIDs of attached VLANs.
- vxlan
Ids List<Integer> - VXLAN ids of attached VLANs.
- device
Id String - port
Id String
- bond
Id string - UUID of the bond port.
- bond
Name string - Name of the bond port.
- bonded boolean
- Flag indicating whether the port is bonded.
- disbond
Supported boolean - Flag indicating whether the port can be removed from a bond.
- id string
- The provider-assigned unique ID for this managed resource.
- layer2 boolean
- mac string
- MAC address of the port.
- name string
- native
Vlan stringId - UUID of native VLAN of the port.
- network
Type string - One of
layer2-bonded
,layer2-individual
,layer3
,hybrid
,hybrid-bonded
. - type string
- Type is either
NetworkBondPort
for bond ports orNetworkPort
for bondable ethernet ports. - vlan
Ids string[] - UUIDs of attached VLANs.
- vxlan
Ids number[] - VXLAN ids of attached VLANs.
- device
Id string - port
Id string
- bond_
id str - UUID of the bond port.
- bond_
name str - Name of the bond port.
- bonded bool
- Flag indicating whether the port is bonded.
- disbond_
supported bool - Flag indicating whether the port can be removed from a bond.
- id str
- The provider-assigned unique ID for this managed resource.
- layer2 bool
- mac str
- MAC address of the port.
- name str
- native_
vlan_ strid - UUID of native VLAN of the port.
- network_
type str - One of
layer2-bonded
,layer2-individual
,layer3
,hybrid
,hybrid-bonded
. - type str
- Type is either
NetworkBondPort
for bond ports orNetworkPort
for bondable ethernet ports. - vlan_
ids Sequence[str] - UUIDs of attached VLANs.
- vxlan_
ids Sequence[int] - VXLAN ids of attached VLANs.
- device_
id str - port_
id str
- bond
Id String - UUID of the bond port.
- bond
Name String - Name of the bond port.
- bonded Boolean
- Flag indicating whether the port is bonded.
- disbond
Supported Boolean - Flag indicating whether the port can be removed from a bond.
- id String
- The provider-assigned unique ID for this managed resource.
- layer2 Boolean
- mac String
- MAC address of the port.
- name String
- native
Vlan StringId - UUID of native VLAN of the port.
- network
Type String - One of
layer2-bonded
,layer2-individual
,layer3
,hybrid
,hybrid-bonded
. - type String
- Type is either
NetworkBondPort
for bond ports orNetworkPort
for bondable ethernet ports. - vlan
Ids List<String> - UUIDs of attached VLANs.
- vxlan
Ids List<Number> - VXLAN ids of attached VLANs.
- device
Id String - port
Id String
Package Details
- Repository
- equinix equinix/pulumi-equinix
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
equinix
Terraform Provider.