oci logo
Oracle Cloud Infrastructure v0.19.0, May 26 23

oci.Core.getPublicIps

Explore with Pulumi AI

This data source provides the list of Public Ips in Oracle Cloud Infrastructure Core service.

Lists the PublicIp objects in the specified compartment. You can filter the list by using query parameters.

To list your reserved public IPs:

  • Set scope = REGION (required)
  • Leave the availabilityDomain parameter empty
  • Set lifetime = RESERVED

To list the ephemeral public IPs assigned to a regional entity such as a NAT gateway:

  • Set scope = REGION (required)
  • Leave the availabilityDomain parameter empty
  • Set lifetime = EPHEMERAL

To list the ephemeral public IPs assigned to private IPs:

  • Set scope = AVAILABILITY_DOMAIN (required)
  • Set the availabilityDomain parameter to the desired availability domain (required)
  • Set lifetime = EPHEMERAL

Note: An ephemeral public IP assigned to a private IP is always in the same availability domain and compartment as the private IP.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testPublicIps = Oci.Core.GetPublicIps.Invoke(new()
    {
        CompartmentId = @var.Compartment_id,
        Scope = @var.Public_ip_scope,
        AvailabilityDomain = @var.Public_ip_availability_domain,
        Lifetime = @var.Public_ip_lifetime,
        PublicIpPoolId = oci_core_public_ip_pool.Test_public_ip_pool.Id,
    });

});
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/go/oci/Core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := Core.GetPublicIps(ctx, &core.GetPublicIpsArgs{
			CompartmentId:      _var.Compartment_id,
			Scope:              _var.Public_ip_scope,
			AvailabilityDomain: pulumi.StringRef(_var.Public_ip_availability_domain),
			Lifetime:           pulumi.StringRef(_var.Public_ip_lifetime),
			PublicIpPoolId:     pulumi.StringRef(oci_core_public_ip_pool.Test_public_ip_pool.Id),
		}, 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.oci.Core.CoreFunctions;
import com.pulumi.oci.Core.inputs.GetPublicIpsArgs;
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 testPublicIps = CoreFunctions.getPublicIps(GetPublicIpsArgs.builder()
            .compartmentId(var_.compartment_id())
            .scope(var_.public_ip_scope())
            .availabilityDomain(var_.public_ip_availability_domain())
            .lifetime(var_.public_ip_lifetime())
            .publicIpPoolId(oci_core_public_ip_pool.test_public_ip_pool().id())
            .build());

    }
}
import pulumi
import pulumi_oci as oci

test_public_ips = oci.Core.get_public_ips(compartment_id=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
    scope=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
    availability_domain=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
    lifetime=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
    public_ip_pool_id=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";

const testPublicIps = oci.Core.getPublicIps({
    compartmentId: _var.compartment_id,
    scope: _var.public_ip_scope,
    availabilityDomain: _var.public_ip_availability_domain,
    lifetime: _var.public_ip_lifetime,
    publicIpPoolId: oci_core_public_ip_pool.test_public_ip_pool.id,
});
variables:
  testPublicIps:
    fn::invoke:
      Function: oci:Core:getPublicIps
      Arguments:
        compartmentId: ${var.compartment_id}
        scope: ${var.public_ip_scope}
        availabilityDomain: ${var.public_ip_availability_domain}
        lifetime: ${var.public_ip_lifetime}
        publicIpPoolId: ${oci_core_public_ip_pool.test_public_ip_pool.id}

Using getPublicIps

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 getPublicIps(args: GetPublicIpsArgs, opts?: InvokeOptions): Promise<GetPublicIpsResult>
function getPublicIpsOutput(args: GetPublicIpsOutputArgs, opts?: InvokeOptions): Output<GetPublicIpsResult>
def get_public_ips(availability_domain: Optional[str] = None,
                   compartment_id: Optional[str] = None,
                   filters: Optional[Sequence[_core.GetPublicIpsFilter]] = None,
                   lifetime: Optional[str] = None,
                   public_ip_pool_id: Optional[str] = None,
                   scope: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetPublicIpsResult
def get_public_ips_output(availability_domain: Optional[pulumi.Input[str]] = None,
                   compartment_id: Optional[pulumi.Input[str]] = None,
                   filters: Optional[pulumi.Input[Sequence[pulumi.Input[_core.GetPublicIpsFilterArgs]]]] = None,
                   lifetime: Optional[pulumi.Input[str]] = None,
                   public_ip_pool_id: Optional[pulumi.Input[str]] = None,
                   scope: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetPublicIpsResult]
func GetPublicIps(ctx *Context, args *GetPublicIpsArgs, opts ...InvokeOption) (*GetPublicIpsResult, error)
func GetPublicIpsOutput(ctx *Context, args *GetPublicIpsOutputArgs, opts ...InvokeOption) GetPublicIpsResultOutput

> Note: This function is named GetPublicIps in the Go SDK.

public static class GetPublicIps 
{
    public static Task<GetPublicIpsResult> InvokeAsync(GetPublicIpsArgs args, InvokeOptions? opts = null)
    public static Output<GetPublicIpsResult> Invoke(GetPublicIpsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPublicIpsResult> getPublicIps(GetPublicIpsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: oci:Core/getPublicIps:getPublicIps
  arguments:
    # arguments dictionary

The following arguments are supported:

CompartmentId string

The OCID of the compartment.

Scope string

Whether the public IP is regional or specific to a particular availability domain.

AvailabilityDomain string

The name of the availability domain. Example: Uocm:PHX-AD-1

Filters List<GetPublicIpsFilter>
Lifetime string

A filter to return only public IPs that match given lifetime.

PublicIpPoolId string

A filter to return only resources that belong to the given public IP pool.

CompartmentId string

The OCID of the compartment.

Scope string

Whether the public IP is regional or specific to a particular availability domain.

AvailabilityDomain string

The name of the availability domain. Example: Uocm:PHX-AD-1

Filters []GetPublicIpsFilter
Lifetime string

A filter to return only public IPs that match given lifetime.

PublicIpPoolId string

A filter to return only resources that belong to the given public IP pool.

compartmentId String

The OCID of the compartment.

scope String

Whether the public IP is regional or specific to a particular availability domain.

availabilityDomain String

The name of the availability domain. Example: Uocm:PHX-AD-1

filters List<GetPublicIpsFilter>
lifetime String

A filter to return only public IPs that match given lifetime.

publicIpPoolId String

A filter to return only resources that belong to the given public IP pool.

compartmentId string

The OCID of the compartment.

scope string

Whether the public IP is regional or specific to a particular availability domain.

availabilityDomain string

The name of the availability domain. Example: Uocm:PHX-AD-1

filters GetPublicIpsFilter[]
lifetime string

A filter to return only public IPs that match given lifetime.

publicIpPoolId string

A filter to return only resources that belong to the given public IP pool.

compartment_id str

The OCID of the compartment.

scope str

Whether the public IP is regional or specific to a particular availability domain.

availability_domain str

The name of the availability domain. Example: Uocm:PHX-AD-1

filters GetPublicIpsFilter]
lifetime str

A filter to return only public IPs that match given lifetime.

public_ip_pool_id str

A filter to return only resources that belong to the given public IP pool.

compartmentId String

The OCID of the compartment.

scope String

Whether the public IP is regional or specific to a particular availability domain.

availabilityDomain String

The name of the availability domain. Example: Uocm:PHX-AD-1

filters List<Property Map>
lifetime String

A filter to return only public IPs that match given lifetime.

publicIpPoolId String

A filter to return only resources that belong to the given public IP pool.

getPublicIps Result

The following output properties are available:

CompartmentId string

The OCID of the compartment containing the public IP. For an ephemeral public IP, this is the compartment of its assigned entity (which can be a private IP or a regional entity such as a NAT gateway). For a reserved public IP that is currently assigned, its compartment can be different from the assigned private IP's.

Id string

The provider-assigned unique ID for this managed resource.

PublicIps List<GetPublicIpsPublicIp>

The list of public_ips.

Scope string

Whether the public IP is regional or specific to a particular availability domain.

AvailabilityDomain string

The public IP's availability domain. This property is set only for ephemeral public IPs that are assigned to a private IP (that is, when the scope of the public IP is set to AVAILABILITY_DOMAIN). The value is the availability domain of the assigned private IP. Example: Uocm:PHX-AD-1

Filters List<GetPublicIpsFilter>
Lifetime string

Defines when the public IP is deleted and released back to Oracle's public IP pool.

PublicIpPoolId string

The OCID of the pool object created in the current tenancy.

CompartmentId string

The OCID of the compartment containing the public IP. For an ephemeral public IP, this is the compartment of its assigned entity (which can be a private IP or a regional entity such as a NAT gateway). For a reserved public IP that is currently assigned, its compartment can be different from the assigned private IP's.

Id string

The provider-assigned unique ID for this managed resource.

PublicIps []GetPublicIpsPublicIp

The list of public_ips.

Scope string

Whether the public IP is regional or specific to a particular availability domain.

AvailabilityDomain string

The public IP's availability domain. This property is set only for ephemeral public IPs that are assigned to a private IP (that is, when the scope of the public IP is set to AVAILABILITY_DOMAIN). The value is the availability domain of the assigned private IP. Example: Uocm:PHX-AD-1

Filters []GetPublicIpsFilter
Lifetime string

Defines when the public IP is deleted and released back to Oracle's public IP pool.

PublicIpPoolId string

The OCID of the pool object created in the current tenancy.

compartmentId String

The OCID of the compartment containing the public IP. For an ephemeral public IP, this is the compartment of its assigned entity (which can be a private IP or a regional entity such as a NAT gateway). For a reserved public IP that is currently assigned, its compartment can be different from the assigned private IP's.

id String

The provider-assigned unique ID for this managed resource.

publicIps List<GetPublicIpsPublicIp>

The list of public_ips.

scope String

Whether the public IP is regional or specific to a particular availability domain.

availabilityDomain String

The public IP's availability domain. This property is set only for ephemeral public IPs that are assigned to a private IP (that is, when the scope of the public IP is set to AVAILABILITY_DOMAIN). The value is the availability domain of the assigned private IP. Example: Uocm:PHX-AD-1

filters List<GetPublicIpsFilter>
lifetime String

Defines when the public IP is deleted and released back to Oracle's public IP pool.

publicIpPoolId String

The OCID of the pool object created in the current tenancy.

compartmentId string

The OCID of the compartment containing the public IP. For an ephemeral public IP, this is the compartment of its assigned entity (which can be a private IP or a regional entity such as a NAT gateway). For a reserved public IP that is currently assigned, its compartment can be different from the assigned private IP's.

id string

The provider-assigned unique ID for this managed resource.

publicIps GetPublicIpsPublicIp[]

The list of public_ips.

scope string

Whether the public IP is regional or specific to a particular availability domain.

availabilityDomain string

The public IP's availability domain. This property is set only for ephemeral public IPs that are assigned to a private IP (that is, when the scope of the public IP is set to AVAILABILITY_DOMAIN). The value is the availability domain of the assigned private IP. Example: Uocm:PHX-AD-1

filters GetPublicIpsFilter[]
lifetime string

Defines when the public IP is deleted and released back to Oracle's public IP pool.

publicIpPoolId string

The OCID of the pool object created in the current tenancy.

compartment_id str

The OCID of the compartment containing the public IP. For an ephemeral public IP, this is the compartment of its assigned entity (which can be a private IP or a regional entity such as a NAT gateway). For a reserved public IP that is currently assigned, its compartment can be different from the assigned private IP's.

id str

The provider-assigned unique ID for this managed resource.

public_ips GetPublicIpsPublicIp]

The list of public_ips.

scope str

Whether the public IP is regional or specific to a particular availability domain.

availability_domain str

The public IP's availability domain. This property is set only for ephemeral public IPs that are assigned to a private IP (that is, when the scope of the public IP is set to AVAILABILITY_DOMAIN). The value is the availability domain of the assigned private IP. Example: Uocm:PHX-AD-1

filters GetPublicIpsFilter]
lifetime str

Defines when the public IP is deleted and released back to Oracle's public IP pool.

public_ip_pool_id str

The OCID of the pool object created in the current tenancy.

compartmentId String

The OCID of the compartment containing the public IP. For an ephemeral public IP, this is the compartment of its assigned entity (which can be a private IP or a regional entity such as a NAT gateway). For a reserved public IP that is currently assigned, its compartment can be different from the assigned private IP's.

id String

The provider-assigned unique ID for this managed resource.

publicIps List<Property Map>

The list of public_ips.

scope String

Whether the public IP is regional or specific to a particular availability domain.

availabilityDomain String

The public IP's availability domain. This property is set only for ephemeral public IPs that are assigned to a private IP (that is, when the scope of the public IP is set to AVAILABILITY_DOMAIN). The value is the availability domain of the assigned private IP. Example: Uocm:PHX-AD-1

filters List<Property Map>
lifetime String

Defines when the public IP is deleted and released back to Oracle's public IP pool.

publicIpPoolId String

The OCID of the pool object created in the current tenancy.

Supporting Types

GetPublicIpsFilter

Name string
Values List<string>
Regex bool
Name string
Values []string
Regex bool
name String
values List<String>
regex Boolean
name string
values string[]
regex boolean
name str
values Sequence[str]
regex bool
name String
values List<String>
regex Boolean

GetPublicIpsPublicIp

AssignedEntityId string

The OCID of the entity the public IP is assigned to, or in the process of being assigned to.

AssignedEntityType string

The type of entity the public IP is assigned to, or in the process of being assigned to.

AvailabilityDomain string

The name of the availability domain. Example: Uocm:PHX-AD-1

CompartmentId string

The OCID of the compartment.

DefinedTags Dictionary<string, object>

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}

DisplayName string

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

FreeformTags Dictionary<string, object>

Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

Id string

The public IP's Oracle ID (OCID).

IpAddress string

The public IP address of the publicIp object. Example: 203.0.113.2

Lifetime string

A filter to return only public IPs that match given lifetime.

PrivateIpId string

Deprecated. Use assignedEntityId instead.

PublicIpPoolId string

A filter to return only resources that belong to the given public IP pool.

Scope string

Whether the public IP is regional or specific to a particular availability domain.

State string

The public IP's current state.

TimeCreated string

The date and time the public IP was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

AssignedEntityId string

The OCID of the entity the public IP is assigned to, or in the process of being assigned to.

AssignedEntityType string

The type of entity the public IP is assigned to, or in the process of being assigned to.

AvailabilityDomain string

The name of the availability domain. Example: Uocm:PHX-AD-1

CompartmentId string

The OCID of the compartment.

DefinedTags map[string]interface{}

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}

DisplayName string

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

FreeformTags map[string]interface{}

Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

Id string

The public IP's Oracle ID (OCID).

IpAddress string

The public IP address of the publicIp object. Example: 203.0.113.2

Lifetime string

A filter to return only public IPs that match given lifetime.

PrivateIpId string

Deprecated. Use assignedEntityId instead.

PublicIpPoolId string

A filter to return only resources that belong to the given public IP pool.

Scope string

Whether the public IP is regional or specific to a particular availability domain.

State string

The public IP's current state.

TimeCreated string

The date and time the public IP was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

assignedEntityId String

The OCID of the entity the public IP is assigned to, or in the process of being assigned to.

assignedEntityType String

The type of entity the public IP is assigned to, or in the process of being assigned to.

availabilityDomain String

The name of the availability domain. Example: Uocm:PHX-AD-1

compartmentId String

The OCID of the compartment.

definedTags Map<String,Object>

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}

displayName String

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

freeformTags Map<String,Object>

Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

id String

The public IP's Oracle ID (OCID).

ipAddress String

The public IP address of the publicIp object. Example: 203.0.113.2

lifetime String

A filter to return only public IPs that match given lifetime.

privateIpId String

Deprecated. Use assignedEntityId instead.

publicIpPoolId String

A filter to return only resources that belong to the given public IP pool.

scope String

Whether the public IP is regional or specific to a particular availability domain.

state String

The public IP's current state.

timeCreated String

The date and time the public IP was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

assignedEntityId string

The OCID of the entity the public IP is assigned to, or in the process of being assigned to.

assignedEntityType string

The type of entity the public IP is assigned to, or in the process of being assigned to.

availabilityDomain string

The name of the availability domain. Example: Uocm:PHX-AD-1

compartmentId string

The OCID of the compartment.

definedTags {[key: string]: any}

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}

displayName string

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

freeformTags {[key: string]: any}

Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

id string

The public IP's Oracle ID (OCID).

ipAddress string

The public IP address of the publicIp object. Example: 203.0.113.2

lifetime string

A filter to return only public IPs that match given lifetime.

privateIpId string

Deprecated. Use assignedEntityId instead.

publicIpPoolId string

A filter to return only resources that belong to the given public IP pool.

scope string

Whether the public IP is regional or specific to a particular availability domain.

state string

The public IP's current state.

timeCreated string

The date and time the public IP was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

assigned_entity_id str

The OCID of the entity the public IP is assigned to, or in the process of being assigned to.

assigned_entity_type str

The type of entity the public IP is assigned to, or in the process of being assigned to.

availability_domain str

The name of the availability domain. Example: Uocm:PHX-AD-1

compartment_id str

The OCID of the compartment.

defined_tags Mapping[str, Any]

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}

display_name str

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

freeform_tags Mapping[str, Any]

Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

id str

The public IP's Oracle ID (OCID).

ip_address str

The public IP address of the publicIp object. Example: 203.0.113.2

lifetime str

A filter to return only public IPs that match given lifetime.

private_ip_id str

Deprecated. Use assignedEntityId instead.

public_ip_pool_id str

A filter to return only resources that belong to the given public IP pool.

scope str

Whether the public IP is regional or specific to a particular availability domain.

state str

The public IP's current state.

time_created str

The date and time the public IP was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

assignedEntityId String

The OCID of the entity the public IP is assigned to, or in the process of being assigned to.

assignedEntityType String

The type of entity the public IP is assigned to, or in the process of being assigned to.

availabilityDomain String

The name of the availability domain. Example: Uocm:PHX-AD-1

compartmentId String

The OCID of the compartment.

definedTags Map<Any>

Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}

displayName String

A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.

freeformTags Map<Any>

Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

id String

The public IP's Oracle ID (OCID).

ipAddress String

The public IP address of the publicIp object. Example: 203.0.113.2

lifetime String

A filter to return only public IPs that match given lifetime.

privateIpId String

Deprecated. Use assignedEntityId instead.

publicIpPoolId String

A filter to return only resources that belong to the given public IP pool.

scope String

Whether the public IP is regional or specific to a particular availability domain.

state String

The public IP's current state.

timeCreated String

The date and time the public IP was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes

This Pulumi package is based on the oci Terraform Provider.