1. Packages
  2. Equinix
  3. API Docs
  4. metal
  5. getPort
Equinix v0.19.0 published on Thursday, Oct 24, 2024 by Equinix

equinix.metal.getPort

Explore with Pulumi AI

equinix logo
Equinix v0.19.0 published on Thursday, Oct 24, 2024 by Equinix

    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:

    DeviceId string
    Device UUID where to lookup the port.
    Name string
    Name of the port to look up, i.e. bond0, eth1.
    PortId string
    ID of the port to read, conflicts with device_id.
    DeviceId string
    Device UUID where to lookup the port.
    Name string
    Name of the port to look up, i.e. bond0, eth1.
    PortId string
    ID of the port to read, conflicts with device_id.
    deviceId String
    Device UUID where to lookup the port.
    name String
    Name of the port to look up, i.e. bond0, eth1.
    portId String
    ID of the port to read, conflicts with device_id.
    deviceId string
    Device UUID where to lookup the port.
    name string
    Name of the port to look up, i.e. bond0, eth1.
    portId string
    ID of the port to read, conflicts with device_id.
    device_id str
    Device UUID where to lookup the port.
    name str
    Name of the port to look up, i.e. bond0, eth1.
    port_id str
    ID of the port to read, conflicts with device_id.
    deviceId String
    Device UUID where to lookup the port.
    name String
    Name of the port to look up, i.e. bond0, eth1.
    portId String
    ID of the port to read, conflicts with device_id.

    getPort Result

    The following output properties are available:

    BondId string
    UUID of the bond port.
    BondName string
    Name of the bond port.
    Bonded bool
    Flag indicating whether the port is bonded.
    DisbondSupported 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
    NativeVlanId string
    UUID of native VLAN of the port.
    NetworkType string
    One of layer2-bonded, layer2-individual, layer3, hybrid, hybrid-bonded.
    Type string
    Type is either NetworkBondPort for bond ports or NetworkPort for bondable ethernet ports.
    VlanIds List<string>
    UUIDs of attached VLANs.
    VxlanIds List<int>
    VXLAN ids of attached VLANs.
    DeviceId string
    PortId string
    BondId string
    UUID of the bond port.
    BondName string
    Name of the bond port.
    Bonded bool
    Flag indicating whether the port is bonded.
    DisbondSupported 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
    NativeVlanId string
    UUID of native VLAN of the port.
    NetworkType string
    One of layer2-bonded, layer2-individual, layer3, hybrid, hybrid-bonded.
    Type string
    Type is either NetworkBondPort for bond ports or NetworkPort for bondable ethernet ports.
    VlanIds []string
    UUIDs of attached VLANs.
    VxlanIds []int
    VXLAN ids of attached VLANs.
    DeviceId string
    PortId string
    bondId String
    UUID of the bond port.
    bondName String
    Name of the bond port.
    bonded Boolean
    Flag indicating whether the port is bonded.
    disbondSupported 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
    nativeVlanId String
    UUID of native VLAN of the port.
    networkType String
    One of layer2-bonded, layer2-individual, layer3, hybrid, hybrid-bonded.
    type String
    Type is either NetworkBondPort for bond ports or NetworkPort for bondable ethernet ports.
    vlanIds List<String>
    UUIDs of attached VLANs.
    vxlanIds List<Integer>
    VXLAN ids of attached VLANs.
    deviceId String
    portId String
    bondId string
    UUID of the bond port.
    bondName string
    Name of the bond port.
    bonded boolean
    Flag indicating whether the port is bonded.
    disbondSupported 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
    nativeVlanId string
    UUID of native VLAN of the port.
    networkType string
    One of layer2-bonded, layer2-individual, layer3, hybrid, hybrid-bonded.
    type string
    Type is either NetworkBondPort for bond ports or NetworkPort for bondable ethernet ports.
    vlanIds string[]
    UUIDs of attached VLANs.
    vxlanIds number[]
    VXLAN ids of attached VLANs.
    deviceId string
    portId 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_id str
    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 or NetworkPort 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
    bondId String
    UUID of the bond port.
    bondName String
    Name of the bond port.
    bonded Boolean
    Flag indicating whether the port is bonded.
    disbondSupported 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
    nativeVlanId String
    UUID of native VLAN of the port.
    networkType String
    One of layer2-bonded, layer2-individual, layer3, hybrid, hybrid-bonded.
    type String
    Type is either NetworkBondPort for bond ports or NetworkPort for bondable ethernet ports.
    vlanIds List<String>
    UUIDs of attached VLANs.
    vxlanIds List<Number>
    VXLAN ids of attached VLANs.
    deviceId String
    portId String

    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.19.0 published on Thursday, Oct 24, 2024 by Equinix