digitalocean.getFloatingIp
Explore with Pulumi AI
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
Get the floating IP:
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);
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)
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, &digitalocean.LookupFloatingIpArgs{
IpAddress: publicIp,
}, nil)
if err != nil {
return err
}
ctx.Export("fipOutput", example.DropletId)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
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 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()));
}
}
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:
- Ip
Address string - The allocated IP address of the specific floating IP to retrieve.
- Ip
Address string - The allocated IP address of the specific floating IP to retrieve.
- ip
Address String - The allocated IP address of the specific floating IP to retrieve.
- ip
Address 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.
- ip
Address String - The allocated IP address of the specific floating IP to retrieve.
getFloatingIp Result
The following output properties are available:
- Droplet
Id int - The Droplet id that the floating IP has been assigned to.
- Floating
Ip stringUrn - The uniform resource name of the floating IP.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ip
Address string - Region string
- The region that the floating IP is reserved to.
- Droplet
Id int - The Droplet id that the floating IP has been assigned to.
- Floating
Ip stringUrn - The uniform resource name of the floating IP.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ip
Address string - Region string
- The region that the floating IP is reserved to.
- droplet
Id Integer - The Droplet id that the floating IP has been assigned to.
- floating
Ip StringUrn - The uniform resource name of the floating IP.
- id String
- The provider-assigned unique ID for this managed resource.
- ip
Address String - region String
- The region that the floating IP is reserved to.
- droplet
Id number - The Droplet id that the floating IP has been assigned to.
- floating
Ip stringUrn - The uniform resource name of the floating IP.
- id string
- The provider-assigned unique ID for this managed resource.
- ip
Address string - region string
- The region that the floating IP is reserved to.
- droplet_
id int - The Droplet id that the floating IP has been assigned to.
- floating_
ip_ strurn - The uniform resource name of the floating IP.
- id str
- The provider-assigned unique ID for this managed resource.
- ip_
address str - region str
- The region that the floating IP is reserved to.
- droplet
Id Number - The Droplet id that the floating IP has been assigned to.
- floating
Ip StringUrn - The uniform resource name of the floating IP.
- id String
- The provider-assigned unique ID for this managed resource.
- ip
Address String - region String
- The region that the floating IP is reserved to.
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
digitalocean
Terraform Provider.