title: "getPort" title_tag: "huaweicloud.Vpc.getPort" meta_desc: "Documentation for the huaweicloud.Vpc.getPort function with examples, input properties, output properties, and supporting types." layout: api no_edit_this_page: true


Use this data source to get the ID of an available HuaweiCloud port.

## Example Usage
using System.Collections.Generic;
using Pulumi;
using Huaweicloud = Pulumi.Huaweicloud;

return await Deployment.RunAsync(() => 
{
    var port1 = Huaweicloud.Vpc.GetPort.Invoke(new()
    {
        NetworkId = @var.Network_id,
        FixedIp = "192.168.0.100",
    });

});
package main

import (
    "github.com/huaweicloud/pulumi-huaweicloud/sdk/go/huaweicloud/Vpc"
    "github.com/pulumi/pulumi-huaweicloud/sdk/go/huaweicloud/Vpc"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := Vpc.GetPort(ctx, &vpc.GetPortArgs{
            NetworkId: pulumi.StringRef(_var.Network_id),
            FixedIp:   pulumi.StringRef("192.168.0.100"),
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.huaweicloud.Vpc.VpcFunctions;
import com.pulumi.huaweicloud.Iec.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 port1 = VpcFunctions.getPort(GetPortArgs.builder()
            .networkId(var_.network_id())
            .fixedIp("192.168.0.100")
            .build());

    }
}
import pulumi
import pulumi_huaweicloud as huaweicloud

port1 = huaweicloud.Vpc.get_port(network_id=var["network_id"],
    fixed_ip="192.168.0.100")
import * as pulumi from "@pulumi/pulumi";
import * as huaweicloud from "@pulumi/huaweicloud";

const port1 = huaweicloud.Vpc.getPort({
    networkId: _var.network_id,
    fixedIp: "192.168.0.100",
});
variables:
  port1:
    Fn::Invoke:
      Function: huaweicloud:Vpc:getPort
      Arguments:
        networkId: ${var.network_id}
        fixedIp: 192.168.0.100

Using getPort {#using}

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(admin_state_up: Optional[bool] = None,
             device_id: Optional[str] = None,
             device_owner: Optional[str] = None,
             fixed_ip: Optional[str] = None,
             mac_address: Optional[str] = None,
             name: Optional[str] = None,
             network_id: Optional[str] = None,
             port_id: Optional[str] = None,
             project_id: Optional[str] = None,
             region: Optional[str] = None,
             security_group_ids: Optional[Sequence[str]] = None,
             status: Optional[str] = None,
             tenant_id: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetPortResult
def get_port_output(admin_state_up: Optional[pulumi.Input[bool]] = None,
             device_id: Optional[pulumi.Input[str]] = None,
             device_owner: Optional[pulumi.Input[str]] = None,
             fixed_ip: Optional[pulumi.Input[str]] = None,
             mac_address: Optional[pulumi.Input[str]] = None,
             name: Optional[pulumi.Input[str]] = None,
             network_id: Optional[pulumi.Input[str]] = None,
             port_id: Optional[pulumi.Input[str]] = None,
             project_id: Optional[pulumi.Input[str]] = None,
             region: Optional[pulumi.Input[str]] = None,
             security_group_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
             status: Optional[pulumi.Input[str]] = None,
             tenant_id: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetPortResult]
func GetPort(ctx *Context, args *GetPortArgs, opts ...InvokeOption) (*GetPortResult, error)
func GetPortOutput(ctx *Context, args *GetPortOutputArgs, opts ...InvokeOption) GetPortResultOutput

> Note: This function is named GetPort 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: huaweicloud:Vpc/getPort:getPort
  Arguments:
    # Arguments dictionary

The following arguments are supported:

AdminStateUp bool

The administrative state of the port.

DeviceId string

The ID of the device the port belongs to.

DeviceOwner string

The device owner of the port.

FixedIp string

Specifies the port IP address filter.

MacAddress string

Specifies the MAC address of the port.

Name string

The name of the port.

NetworkId string

Specifies the ID of the network the port belongs to.

PortId string

Specifies the ID of the port.

ProjectId string
Region string

Specifies the region in which to obtain the port. If omitted, the provider-level region will be used.

SecurityGroupIds List<string>

The list of port security group IDs to filter.

Status string

Specifies the status of the port.

TenantId string
AdminStateUp bool

The administrative state of the port.

DeviceId string

The ID of the device the port belongs to.

DeviceOwner string

The device owner of the port.

FixedIp string

Specifies the port IP address filter.

MacAddress string

Specifies the MAC address of the port.

Name string

The name of the port.

NetworkId string

Specifies the ID of the network the port belongs to.

PortId string

Specifies the ID of the port.

ProjectId string
Region string

Specifies the region in which to obtain the port. If omitted, the provider-level region will be used.

SecurityGroupIds []string

The list of port security group IDs to filter.

Status string

Specifies the status of the port.

TenantId string
adminStateUp Boolean

The administrative state of the port.

deviceId String

The ID of the device the port belongs to.

deviceOwner String

The device owner of the port.

fixedIp String

Specifies the port IP address filter.

macAddress String

Specifies the MAC address of the port.

name String

The name of the port.

networkId String

Specifies the ID of the network the port belongs to.

portId String

Specifies the ID of the port.

projectId String
region String

Specifies the region in which to obtain the port. If omitted, the provider-level region will be used.

securityGroupIds List<String>

The list of port security group IDs to filter.

status String

Specifies the status of the port.

tenantId String
adminStateUp boolean

The administrative state of the port.

deviceId string

The ID of the device the port belongs to.

deviceOwner string

The device owner of the port.

fixedIp string

Specifies the port IP address filter.

macAddress string

Specifies the MAC address of the port.

name string

The name of the port.

networkId string

Specifies the ID of the network the port belongs to.

portId string

Specifies the ID of the port.

projectId string
region string

Specifies the region in which to obtain the port. If omitted, the provider-level region will be used.

securityGroupIds string[]

The list of port security group IDs to filter.

status string

Specifies the status of the port.

tenantId string
admin_state_up bool

The administrative state of the port.

device_id str

The ID of the device the port belongs to.

device_owner str

The device owner of the port.

fixed_ip str

Specifies the port IP address filter.

mac_address str

Specifies the MAC address of the port.

name str

The name of the port.

network_id str

Specifies the ID of the network the port belongs to.

port_id str

Specifies the ID of the port.

project_id str
region str

Specifies the region in which to obtain the port. If omitted, the provider-level region will be used.

security_group_ids Sequence[str]

The list of port security group IDs to filter.

status str

Specifies the status of the port.

tenant_id str
adminStateUp Boolean

The administrative state of the port.

deviceId String

The ID of the device the port belongs to.

deviceOwner String

The device owner of the port.

fixedIp String

Specifies the port IP address filter.

macAddress String

Specifies the MAC address of the port.

name String

The name of the port.

networkId String

Specifies the ID of the network the port belongs to.

portId String

Specifies the ID of the port.

projectId String
region String

Specifies the region in which to obtain the port. If omitted, the provider-level region will be used.

securityGroupIds List<String>

The list of port security group IDs to filter.

status String

Specifies the status of the port.

tenantId String

getPort Result {#result}

The following output properties are available:

AdminStateUp bool

The administrative state of the port.

AllFixedIps List<string>

The collection of Fixed IP addresses on the port.

AllSecurityGroupIds List<string>

The collection of security group IDs applied on the port.

DeviceId string

The ID of the device the port belongs to.

DeviceOwner string

The device owner of the port.

Id string

The provider-assigned unique ID for this managed resource.

MacAddress string
Name string

The name of the port.

NetworkId string
PortId string
Region string
Status string
FixedIp string
ProjectId string
SecurityGroupIds List<string>
TenantId string
AdminStateUp bool

The administrative state of the port.

AllFixedIps []string

The collection of Fixed IP addresses on the port.

AllSecurityGroupIds []string

The collection of security group IDs applied on the port.

DeviceId string

The ID of the device the port belongs to.

DeviceOwner string

The device owner of the port.

Id string

The provider-assigned unique ID for this managed resource.

MacAddress string
Name string

The name of the port.

NetworkId string
PortId string
Region string
Status string
FixedIp string
ProjectId string
SecurityGroupIds []string
TenantId string
adminStateUp Boolean

The administrative state of the port.

allFixedIps List<String>

The collection of Fixed IP addresses on the port.

allSecurityGroupIds List<String>

The collection of security group IDs applied on the port.

deviceId String

The ID of the device the port belongs to.

deviceOwner String

The device owner of the port.

id String

The provider-assigned unique ID for this managed resource.

macAddress String
name String

The name of the port.

networkId String
portId String
region String
status String
fixedIp String
projectId String
securityGroupIds List<String>
tenantId String
adminStateUp boolean

The administrative state of the port.

allFixedIps string[]

The collection of Fixed IP addresses on the port.

allSecurityGroupIds string[]

The collection of security group IDs applied on the port.

deviceId string

The ID of the device the port belongs to.

deviceOwner string

The device owner of the port.

id string

The provider-assigned unique ID for this managed resource.

macAddress string
name string

The name of the port.

networkId string
portId string
region string
status string
fixedIp string
projectId string
securityGroupIds string[]
tenantId string
admin_state_up bool

The administrative state of the port.

all_fixed_ips Sequence[str]

The collection of Fixed IP addresses on the port.

all_security_group_ids Sequence[str]

The collection of security group IDs applied on the port.

device_id str

The ID of the device the port belongs to.

device_owner str

The device owner of the port.

id str

The provider-assigned unique ID for this managed resource.

mac_address str
name str

The name of the port.

network_id str
port_id str
region str
status str
fixed_ip str
project_id str
security_group_ids Sequence[str]
tenant_id str
adminStateUp Boolean

The administrative state of the port.

allFixedIps List<String>

The collection of Fixed IP addresses on the port.

allSecurityGroupIds List<String>

The collection of security group IDs applied on the port.

deviceId String

The ID of the device the port belongs to.

deviceOwner String

The device owner of the port.

id String

The provider-assigned unique ID for this managed resource.

macAddress String
name String

The name of the port.

networkId String
portId String
region String
status String
fixedIp String
projectId String
securityGroupIds List<String>
tenantId String

Package Details

Repository
https://github.com/huaweicloud/pulumi-huaweicloud
License
Apache-2.0
Notes

This Pulumi package is based on the huaweicloud Terraform Provider.