1. Packages
  2. Digitalocean Provider
  3. API Docs
  4. getFloatingIp
DigitalOcean v4.33.0 published on Thursday, Sep 26, 2024 by Pulumi

digitalocean.getFloatingIp

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.33.0 published on Thursday, Sep 26, 2024 by Pulumi

    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:

    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
    The Droplet id that the floating IP has been assigned to.
    FloatingIpUrn string
    The uniform resource name of the floating IP.
    Id string
    The provider-assigned unique ID for this managed resource.
    IpAddress string
    Region string
    The region that the floating IP is reserved to.
    DropletId int
    The Droplet id that the floating IP has been assigned to.
    FloatingIpUrn string
    The uniform resource name of the floating IP.
    Id string
    The provider-assigned unique ID for this managed resource.
    IpAddress string
    Region string
    The region that the floating IP is reserved to.
    dropletId Integer
    The Droplet id that the floating IP has been assigned to.
    floatingIpUrn String
    The uniform resource name of the floating IP.
    id String
    The provider-assigned unique ID for this managed resource.
    ipAddress String
    region String
    The region that the floating IP is reserved to.
    dropletId number
    The Droplet id that the floating IP has been assigned to.
    floatingIpUrn string
    The uniform resource name of the floating IP.
    id string
    The provider-assigned unique ID for this managed resource.
    ipAddress 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_urn str
    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.
    dropletId Number
    The Droplet id that the floating IP has been assigned to.
    floatingIpUrn String
    The uniform resource name of the floating IP.
    id String
    The provider-assigned unique ID for this managed resource.
    ipAddress 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.
    digitalocean logo
    DigitalOcean v4.33.0 published on Thursday, Sep 26, 2024 by Pulumi