OpenStack v5.3.3 published on Friday, Sep 12, 2025 by Pulumi
openstack.networking.getPort
Use this data source to get the ID of an available OpenStack port.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const port1 = openstack.networking.getPort({
name: "port_1",
});
import pulumi
import pulumi_openstack as openstack
port1 = openstack.networking.get_port(name="port_1")
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/networking"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := networking.LookupPort(ctx, &networking.LookupPortArgs{
Name: pulumi.StringRef("port_1"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var port1 = OpenStack.Networking.GetPort.Invoke(new()
{
Name = "port_1",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.NetworkingFunctions;
import com.pulumi.openstack.networking.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 = NetworkingFunctions.getPort(GetPortArgs.builder()
.name("port_1")
.build());
}
}
variables:
port1:
fn::invoke:
function: openstack:networking:getPort
arguments:
name: port_1
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(admin_state_up: Optional[bool] = None,
description: Optional[str] = None,
device_id: Optional[str] = None,
device_owner: Optional[str] = None,
dns_name: 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,
tags: Optional[Sequence[str]] = None,
tenant_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPortResult
def get_port_output(admin_state_up: Optional[pulumi.Input[bool]] = None,
description: Optional[pulumi.Input[str]] = None,
device_id: Optional[pulumi.Input[str]] = None,
device_owner: Optional[pulumi.Input[str]] = None,
dns_name: 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,
tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
tenant_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)
public static Output<GetPortResult> getPort(GetPortArgs args, InvokeOptions options)
fn::invoke:
function: openstack:networking/getPort:getPort
arguments:
# arguments dictionaryThe following arguments are supported:
- Admin
State boolUp - The administrative state of the port.
- Description string
- Human-readable description of the port.
- Device
Id string - The ID of the device the port belongs to.
- Device
Owner string - The device owner of the port.
- Dns
Name string - The port DNS name to filter. Available, when Neutron DNS extension is enabled.
- Fixed
Ip string - The port IP address filter.
- Mac
Address string - The MAC address of the port.
- Name string
- The name of the port.
- Network
Id string - The ID of the network the port belongs to.
- Port
Id string - The ID of the port.
- Project
Id string - The owner of the port.
- Region string
- The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve port ids. If omitted, the
regionargument of the provider is used. - Security
Group List<string>Ids - The list of port security group IDs to filter.
- Status string
- The status of the port.
- List<string>
- The list of port tags to filter.
- Tenant
Id string
- Admin
State boolUp - The administrative state of the port.
- Description string
- Human-readable description of the port.
- Device
Id string - The ID of the device the port belongs to.
- Device
Owner string - The device owner of the port.
- Dns
Name string - The port DNS name to filter. Available, when Neutron DNS extension is enabled.
- Fixed
Ip string - The port IP address filter.
- Mac
Address string - The MAC address of the port.
- Name string
- The name of the port.
- Network
Id string - The ID of the network the port belongs to.
- Port
Id string - The ID of the port.
- Project
Id string - The owner of the port.
- Region string
- The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve port ids. If omitted, the
regionargument of the provider is used. - Security
Group []stringIds - The list of port security group IDs to filter.
- Status string
- The status of the port.
- []string
- The list of port tags to filter.
- Tenant
Id string
- admin
State BooleanUp - The administrative state of the port.
- description String
- Human-readable description of the port.
- device
Id String - The ID of the device the port belongs to.
- device
Owner String - The device owner of the port.
- dns
Name String - The port DNS name to filter. Available, when Neutron DNS extension is enabled.
- fixed
Ip String - The port IP address filter.
- mac
Address String - The MAC address of the port.
- name String
- The name of the port.
- network
Id String - The ID of the network the port belongs to.
- port
Id String - The ID of the port.
- project
Id String - The owner of the port.
- region String
- The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve port ids. If omitted, the
regionargument of the provider is used. - security
Group List<String>Ids - The list of port security group IDs to filter.
- status String
- The status of the port.
- List<String>
- The list of port tags to filter.
- tenant
Id String
- admin
State booleanUp - The administrative state of the port.
- description string
- Human-readable description of the port.
- device
Id string - The ID of the device the port belongs to.
- device
Owner string - The device owner of the port.
- dns
Name string - The port DNS name to filter. Available, when Neutron DNS extension is enabled.
- fixed
Ip string - The port IP address filter.
- mac
Address string - The MAC address of the port.
- name string
- The name of the port.
- network
Id string - The ID of the network the port belongs to.
- port
Id string - The ID of the port.
- project
Id string - The owner of the port.
- region string
- The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve port ids. If omitted, the
regionargument of the provider is used. - security
Group string[]Ids - The list of port security group IDs to filter.
- status string
- The status of the port.
- string[]
- The list of port tags to filter.
- tenant
Id string
- admin_
state_ boolup - The administrative state of the port.
- description str
- Human-readable description of the port.
- device_
id str - The ID of the device the port belongs to.
- device_
owner str - The device owner of the port.
- dns_
name str - The port DNS name to filter. Available, when Neutron DNS extension is enabled.
- fixed_
ip str - The port IP address filter.
- mac_
address str - The MAC address of the port.
- name str
- The name of the port.
- network_
id str - The ID of the network the port belongs to.
- port_
id str - The ID of the port.
- project_
id str - The owner of the port.
- region str
- The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve port ids. If omitted, the
regionargument of the provider is used. - security_
group_ Sequence[str]ids - The list of port security group IDs to filter.
- status str
- The status of the port.
- Sequence[str]
- The list of port tags to filter.
- tenant_
id str
- admin
State BooleanUp - The administrative state of the port.
- description String
- Human-readable description of the port.
- device
Id String - The ID of the device the port belongs to.
- device
Owner String - The device owner of the port.
- dns
Name String - The port DNS name to filter. Available, when Neutron DNS extension is enabled.
- fixed
Ip String - The port IP address filter.
- mac
Address String - The MAC address of the port.
- name String
- The name of the port.
- network
Id String - The ID of the network the port belongs to.
- port
Id String - The ID of the port.
- project
Id String - The owner of the port.
- region String
- The region in which to obtain the V2 Neutron client.
A Neutron client is needed to retrieve port ids. If omitted, the
regionargument of the provider is used. - security
Group List<String>Ids - The list of port security group IDs to filter.
- status String
- The status of the port.
- List<String>
- The list of port tags to filter.
- tenant
Id String
getPort Result
The following output properties are available:
- All
Fixed List<string>Ips - The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
- All
Security List<string>Group Ids - The set of security group IDs applied on the port.
- List<string>
- The set of string tags applied on the port.
- Allowed
Address List<Pulumi.Pairs Open Stack. Networking. Outputs. Get Port Allowed Address Pair> - An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
- Bindings
List<Pulumi.
Open Stack. Networking. Outputs. Get Port Binding> - The port binding information. The structure is described below.
- Dns
Assignments List<ImmutableDictionary<string, string>> - The list of maps representing port DNS assignments.
- Extra
Dhcp List<Pulumi.Options Open Stack. Networking. Outputs. Get Port Extra Dhcp Option> - An extra DHCP option configured on the port. The structure is described below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Admin
State boolUp - See Argument Reference above.
- Description string
- See Argument Reference above.
- Device
Id string - See Argument Reference above.
- Device
Owner string - See Argument Reference above.
- Dns
Name string - See Argument Reference above.
- Fixed
Ip string - Mac
Address string - The additional MAC address.
- Name string
- Name of the DHCP option.
- Network
Id string - See Argument Reference above.
- Port
Id string - See Argument Reference above.
- Project
Id string - See Argument Reference above.
- Region string
- See Argument Reference above.
- Security
Group List<string>Ids - Status string
- List<string>
- Tenant
Id string
- All
Fixed []stringIps - The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
- All
Security []stringGroup Ids - The set of security group IDs applied on the port.
- []string
- The set of string tags applied on the port.
- Allowed
Address []GetPairs Port Allowed Address Pair - An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
- Bindings
[]Get
Port Binding - The port binding information. The structure is described below.
- Dns
Assignments []map[string]string - The list of maps representing port DNS assignments.
- Extra
Dhcp []GetOptions Port Extra Dhcp Option - An extra DHCP option configured on the port. The structure is described below.
- Id string
- The provider-assigned unique ID for this managed resource.
- Admin
State boolUp - See Argument Reference above.
- Description string
- See Argument Reference above.
- Device
Id string - See Argument Reference above.
- Device
Owner string - See Argument Reference above.
- Dns
Name string - See Argument Reference above.
- Fixed
Ip string - Mac
Address string - The additional MAC address.
- Name string
- Name of the DHCP option.
- Network
Id string - See Argument Reference above.
- Port
Id string - See Argument Reference above.
- Project
Id string - See Argument Reference above.
- Region string
- See Argument Reference above.
- Security
Group []stringIds - Status string
- []string
- Tenant
Id string
- all
Fixed List<String>Ips - The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
- all
Security List<String>Group Ids - The set of security group IDs applied on the port.
- List<String>
- The set of string tags applied on the port.
- allowed
Address List<GetPairs Port Allowed Address Pair> - An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
- bindings
List<Get
Port Binding> - The port binding information. The structure is described below.
- dns
Assignments List<Map<String,String>> - The list of maps representing port DNS assignments.
- extra
Dhcp List<GetOptions Port Extra Dhcp Option> - An extra DHCP option configured on the port. The structure is described below.
- id String
- The provider-assigned unique ID for this managed resource.
- admin
State BooleanUp - See Argument Reference above.
- description String
- See Argument Reference above.
- device
Id String - See Argument Reference above.
- device
Owner String - See Argument Reference above.
- dns
Name String - See Argument Reference above.
- fixed
Ip String - mac
Address String - The additional MAC address.
- name String
- Name of the DHCP option.
- network
Id String - See Argument Reference above.
- port
Id String - See Argument Reference above.
- project
Id String - See Argument Reference above.
- region String
- See Argument Reference above.
- security
Group List<String>Ids - status String
- List<String>
- tenant
Id String
- all
Fixed string[]Ips - The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
- all
Security string[]Group Ids - The set of security group IDs applied on the port.
- string[]
- The set of string tags applied on the port.
- allowed
Address GetPairs Port Allowed Address Pair[] - An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
- bindings
Get
Port Binding[] - The port binding information. The structure is described below.
- dns
Assignments {[key: string]: string}[] - The list of maps representing port DNS assignments.
- extra
Dhcp GetOptions Port Extra Dhcp Option[] - An extra DHCP option configured on the port. The structure is described below.
- id string
- The provider-assigned unique ID for this managed resource.
- admin
State booleanUp - See Argument Reference above.
- description string
- See Argument Reference above.
- device
Id string - See Argument Reference above.
- device
Owner string - See Argument Reference above.
- dns
Name string - See Argument Reference above.
- fixed
Ip string - mac
Address string - The additional MAC address.
- name string
- Name of the DHCP option.
- network
Id string - See Argument Reference above.
- port
Id string - See Argument Reference above.
- project
Id string - See Argument Reference above.
- region string
- See Argument Reference above.
- security
Group string[]Ids - status string
- string[]
- tenant
Id string
- all_
fixed_ Sequence[str]ips - The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
- all_
security_ Sequence[str]group_ ids - The set of security group IDs applied on the port.
- Sequence[str]
- The set of string tags applied on the port.
- allowed_
address_ Sequence[Getpairs Port Allowed Address Pair] - An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
- bindings
Sequence[Get
Port Binding] - The port binding information. The structure is described below.
- dns_
assignments Sequence[Mapping[str, str]] - The list of maps representing port DNS assignments.
- extra_
dhcp_ Sequence[Getoptions Port Extra Dhcp Option] - An extra DHCP option configured on the port. The structure is described below.
- id str
- The provider-assigned unique ID for this managed resource.
- admin_
state_ boolup - See Argument Reference above.
- description str
- See Argument Reference above.
- device_
id str - See Argument Reference above.
- device_
owner str - See Argument Reference above.
- dns_
name str - See Argument Reference above.
- fixed_
ip str - mac_
address str - The additional MAC address.
- name str
- Name of the DHCP option.
- network_
id str - See Argument Reference above.
- port_
id str - See Argument Reference above.
- project_
id str - See Argument Reference above.
- region str
- See Argument Reference above.
- security_
group_ Sequence[str]ids - status str
- Sequence[str]
- tenant_
id str
- all
Fixed List<String>Ips - The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
- all
Security List<String>Group Ids - The set of security group IDs applied on the port.
- List<String>
- The set of string tags applied on the port.
- allowed
Address List<Property Map>Pairs - An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
- bindings List<Property Map>
- The port binding information. The structure is described below.
- dns
Assignments List<Map<String>> - The list of maps representing port DNS assignments.
- extra
Dhcp List<Property Map>Options - An extra DHCP option configured on the port. The structure is described below.
- id String
- The provider-assigned unique ID for this managed resource.
- admin
State BooleanUp - See Argument Reference above.
- description String
- See Argument Reference above.
- device
Id String - See Argument Reference above.
- device
Owner String - See Argument Reference above.
- dns
Name String - See Argument Reference above.
- fixed
Ip String - mac
Address String - The additional MAC address.
- name String
- Name of the DHCP option.
- network
Id String - See Argument Reference above.
- port
Id String - See Argument Reference above.
- project
Id String - See Argument Reference above.
- region String
- See Argument Reference above.
- security
Group List<String>Ids - status String
- List<String>
- tenant
Id String
Supporting Types
GetPortAllowedAddressPair
- Ip
Address string - The additional IP address.
- Mac
Address string - The MAC address of the port.
- Ip
Address string - The additional IP address.
- Mac
Address string - The MAC address of the port.
- ip
Address String - The additional IP address.
- mac
Address String - The MAC address of the port.
- ip
Address string - The additional IP address.
- mac
Address string - The MAC address of the port.
- ip_
address str - The additional IP address.
- mac_
address str - The MAC address of the port.
- ip
Address String - The additional IP address.
- mac
Address String - The MAC address of the port.
GetPortBinding
- Host
Id string - The ID of the host, which has the allocatee port.
- Profile string
- A JSON string containing the binding profile information.
- Vif
Details Dictionary<string, string> - A map of JSON strings containing additional details for this specific binding.
- Vif
Type string - The VNIC type of the port binding.
- Vnic
Type string - VNIC type for the port.
- Host
Id string - The ID of the host, which has the allocatee port.
- Profile string
- A JSON string containing the binding profile information.
- Vif
Details map[string]string - A map of JSON strings containing additional details for this specific binding.
- Vif
Type string - The VNIC type of the port binding.
- Vnic
Type string - VNIC type for the port.
- host
Id String - The ID of the host, which has the allocatee port.
- profile String
- A JSON string containing the binding profile information.
- vif
Details Map<String,String> - A map of JSON strings containing additional details for this specific binding.
- vif
Type String - The VNIC type of the port binding.
- vnic
Type String - VNIC type for the port.
- host
Id string - The ID of the host, which has the allocatee port.
- profile string
- A JSON string containing the binding profile information.
- vif
Details {[key: string]: string} - A map of JSON strings containing additional details for this specific binding.
- vif
Type string - The VNIC type of the port binding.
- vnic
Type string - VNIC type for the port.
- host_
id str - The ID of the host, which has the allocatee port.
- profile str
- A JSON string containing the binding profile information.
- vif_
details Mapping[str, str] - A map of JSON strings containing additional details for this specific binding.
- vif_
type str - The VNIC type of the port binding.
- vnic_
type str - VNIC type for the port.
- host
Id String - The ID of the host, which has the allocatee port.
- profile String
- A JSON string containing the binding profile information.
- vif
Details Map<String> - A map of JSON strings containing additional details for this specific binding.
- vif
Type String - The VNIC type of the port binding.
- vnic
Type String - VNIC type for the port.
GetPortExtraDhcpOption
- ip_
version int - IP protocol version
- name str
- The name of the port.
- value str
- Value of the DHCP option.
Package Details
- Repository
- OpenStack pulumi/pulumi-openstack
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
openstackTerraform Provider.
