DigitalOcean

v4.16.0 published on Wednesday, Sep 28, 2022 by Pulumi

getFloatingIp

Deprecated: DigitalOcean Floating IPs have been renamed reserved IPs. This data source will be removed in a future release. Please use digitalocean.ReservedIp instead.

Get information on a floating ip. This data source provides the region and Droplet id as configured on your DigitalOcean account. This is useful if the floating IP in question is not managed by the provider or you need to find the Droplet the IP is attached to.

An error is triggered if the provided floating IP does not exist.

Example Usage

using System.Collections.Generic;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var publicIp = config.RequireObject<dynamic>("publicIp");
    var example = DigitalOcean.GetFloatingIp.Invoke(new()
    {
        IpAddress = publicIp,
    });

    return new Dictionary<string, object?>
    {
        ["fipOutput"] = example.Apply(getFloatingIpResult => getFloatingIpResult.DropletId),
    };
});
package main

import (
	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		publicIp := cfg.RequireObject("publicIp")
		example, err := digitalocean.LookupFloatingIp(ctx, &GetFloatingIpArgs{
			IpAddress: publicIp,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("fipOutput", example.DropletId)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetFloatingIpArgs;
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 config = ctx.config();
        final var publicIp = config.get("publicIp");
        final var example = DigitaloceanFunctions.getFloatingIp(GetFloatingIpArgs.builder()
            .ipAddress(publicIp)
            .build());

        ctx.export("fipOutput", example.applyValue(getFloatingIpResult -> getFloatingIpResult.dropletId()));
    }
}
import pulumi
import pulumi_digitalocean as digitalocean

config = pulumi.Config()
public_ip = config.require_object("publicIp")
example = digitalocean.get_floating_ip(ip_address=public_ip)
pulumi.export("fipOutput", example.droplet_id)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const config = new pulumi.Config();
const publicIp = config.requireObject("publicIp");
const example = digitalocean.getFloatingIp({
    ipAddress: publicIp,
});
export const fipOutput = example.then(example => example.dropletId);
configuration:
  publicIp:
    type: dynamic
variables:
  example:
    Fn::Invoke:
      Function: digitalocean:getFloatingIp
      Arguments:
        ipAddress: ${publicIp}
outputs:
  fipOutput: ${example.dropletId}

Using getFloatingIp

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 getFloatingIp(args: GetFloatingIpArgs, opts?: InvokeOptions): Promise<GetFloatingIpResult>
function getFloatingIpOutput(args: GetFloatingIpOutputArgs, opts?: InvokeOptions): Output<GetFloatingIpResult>
def get_floating_ip(ip_address: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetFloatingIpResult
def get_floating_ip_output(ip_address: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetFloatingIpResult]
func LookupFloatingIp(ctx *Context, args *LookupFloatingIpArgs, opts ...InvokeOption) (*LookupFloatingIpResult, error)
func LookupFloatingIpOutput(ctx *Context, args *LookupFloatingIpOutputArgs, opts ...InvokeOption) LookupFloatingIpResultOutput

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

public static class GetFloatingIp 
{
    public static Task<GetFloatingIpResult> InvokeAsync(GetFloatingIpArgs args, InvokeOptions? opts = null)
    public static Output<GetFloatingIpResult> Invoke(GetFloatingIpInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetFloatingIpResult> getFloatingIp(GetFloatingIpArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: digitalocean:index/getFloatingIp:getFloatingIp
  Arguments:
    # Arguments dictionary

The following arguments are supported:

IpAddress string

The allocated IP address of the specific floating IP to retrieve.

IpAddress string

The allocated IP address of the specific floating IP to retrieve.

ipAddress String

The allocated IP address of the specific floating IP to retrieve.

ipAddress string

The allocated IP address of the specific floating IP to retrieve.

ip_address str

The allocated IP address of the specific floating IP to retrieve.

ipAddress String

The allocated IP address of the specific floating IP to retrieve.

getFloatingIp Result

The following output properties are available:

DropletId int
FloatingIpUrn string
Id string

The provider-assigned unique ID for this managed resource.

IpAddress string
Region string
DropletId int
FloatingIpUrn string
Id string

The provider-assigned unique ID for this managed resource.

IpAddress string
Region string
dropletId Integer
floatingIpUrn String
id String

The provider-assigned unique ID for this managed resource.

ipAddress String
region String
dropletId number
floatingIpUrn string
id string

The provider-assigned unique ID for this managed resource.

ipAddress string
region string
droplet_id int
floating_ip_urn str
id str

The provider-assigned unique ID for this managed resource.

ip_address str
region str
dropletId Number
floatingIpUrn String
id String

The provider-assigned unique ID for this managed resource.

ipAddress String
region String

Package Details

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

This Pulumi package is based on the digitalocean Terraform Provider.