Data Source: oci_core_public_ip

This data source provides details about a specific Public Ip resource in Oracle Cloud Infrastructure Core service.

Gets the specified public IP. You must specify the object’s OCID.

Alternatively, you can get the object by using GetPublicIpByIpAddress with the public IP address (for example, 203.0.113.2).

Or you can use GetPublicIpByPrivateIpId with the OCID of the private IP that the public IP is assigned to.

Note: If you’re fetching a reserved public IP that is in the process of being moved to a different private IP, the service returns the public IP object with lifecycleState = ASSIGNING and assignedEntityId = OCID of the target private IP.

Example Usage

Get a public ip by public ip id

data "oci_core_public_ip" "test_oci_core_public_ip_by_id" {
    id = var.test_public_ip_id
}

Get a public ip by private ip id

data "oci_core_public_ip" "test_oci_core_public_ip_by_private_ip_id" {
    private_ip_id = var.test_public_ip_private_ip_id
}

Get a public ip by public ip address

data "oci_core_public_ip" "test_oci_core_public_ip_by_ip" {
    ip_address = var.test_public_ip_ip_address
}

Argument Reference

The following arguments are supported:

Only one of the following values will be used. If multiple arguments are passed, the first non-empty value will be used based on the order below.

Attributes Reference

The following attributes are exported: