getDroplet

Get information on a Droplet for use in other resources. This data source provides all of the Droplet’s properties as configured on your DigitalOcean account. This is useful if the Droplet in question is not managed by this provider or you need to utilize any of the Droplet’s data.

Note: This data source returns a single Droplet. When specifying a tag, an error is triggered if more than one Droplet is found.

Example Usage

Get the Droplet by name

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

return await Deployment.RunAsync(() => 
{
    var example = DigitalOcean.GetDroplet.Invoke(new()
    {
        Name = "web",
    });

    return new Dictionary<string, object?>
    {
        ["dropletOutput"] = example.Apply(getDropletResult => getDropletResult.Ipv4Address),
    };
});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := digitalocean.LookupDroplet(ctx, &GetDropletArgs{
			Name: pulumi.StringRef("web"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("dropletOutput", example.Ipv4Address)
		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.GetDropletArgs;
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 example = DigitaloceanFunctions.getDroplet(GetDropletArgs.builder()
            .name("web")
            .build());

        ctx.export("dropletOutput", example.applyValue(getDropletResult -> getDropletResult.ipv4Address()));
    }
}
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_droplet(name="web")
pulumi.export("dropletOutput", example.ipv4_address)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const example = digitalocean.getDroplet({
    name: "web",
});
export const dropletOutput = example.then(example => example.ipv4Address);
variables:
  example:
    Fn::Invoke:
      Function: digitalocean:getDroplet
      Arguments:
        name: web
outputs:
  dropletOutput: ${example.ipv4Address}

Get the Droplet by tag

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

return await Deployment.RunAsync(() => 
{
    var example = DigitalOcean.GetDroplet.Invoke(new()
    {
        Tag = "web",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := digitalocean.LookupDroplet(ctx, &GetDropletArgs{
			Tag: pulumi.StringRef("web"),
		}, 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.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetDropletArgs;
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 example = DigitaloceanFunctions.getDroplet(GetDropletArgs.builder()
            .tag("web")
            .build());

    }
}
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_droplet(tag="web")
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const example = pulumi.output(digitalocean.getDroplet({
    tag: "web",
}));
variables:
  example:
    Fn::Invoke:
      Function: digitalocean:getDroplet
      Arguments:
        tag: web

Get the Droplet by ID

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

return await Deployment.RunAsync(() => 
{
    var example = DigitalOcean.GetDroplet.Invoke(new()
    {
        Id = digitalocean_kubernetes_cluster.Example.Node_pool[0].Nodes[0].Droplet_id,
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := digitalocean.LookupDroplet(ctx, &GetDropletArgs{
			Id: pulumi.IntRef(digitalocean_kubernetes_cluster.Example.Node_pool[0].Nodes[0].Droplet_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.digitalocean.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetDropletArgs;
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 example = DigitaloceanFunctions.getDroplet(GetDropletArgs.builder()
            .id(digitalocean_kubernetes_cluster.example().node_pool()[0].nodes()[0].droplet_id())
            .build());

    }
}
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_droplet(id=digitalocean_kubernetes_cluster["example"]["node_pool"][0]["nodes"][0]["droplet_id"])
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const example = digitalocean.getDroplet({
    id: digitalocean_kubernetes_cluster.example.node_pool[0].nodes[0].droplet_id,
});
variables:
  example:
    Fn::Invoke:
      Function: digitalocean:getDroplet
      Arguments:
        id: ${digitalocean_kubernetes_cluster.example.node_pool[0].nodes[0].droplet_id}

Using getDroplet

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 getDroplet(args: GetDropletArgs, opts?: InvokeOptions): Promise<GetDropletResult>
function getDropletOutput(args: GetDropletOutputArgs, opts?: InvokeOptions): Output<GetDropletResult>
def get_droplet(id: Optional[int] = None,
                name: Optional[str] = None,
                tag: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetDropletResult
def get_droplet_output(id: Optional[pulumi.Input[int]] = None,
                name: Optional[pulumi.Input[str]] = None,
                tag: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetDropletResult]
func LookupDroplet(ctx *Context, args *LookupDropletArgs, opts ...InvokeOption) (*LookupDropletResult, error)
func LookupDropletOutput(ctx *Context, args *LookupDropletOutputArgs, opts ...InvokeOption) LookupDropletResultOutput

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

public static class GetDroplet 
{
    public static Task<GetDropletResult> InvokeAsync(GetDropletArgs args, InvokeOptions? opts = null)
    public static Output<GetDropletResult> Invoke(GetDropletInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDropletResult> getDroplet(GetDropletArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: digitalocean:index/getDroplet:getDroplet
  arguments:
    # arguments dictionary

The following arguments are supported:

Id int

The ID of the Droplet

Name string

The name of the Droplet.

Tag string

A tag applied to the Droplet.

Id int

The ID of the Droplet

Name string

The name of the Droplet.

Tag string

A tag applied to the Droplet.

id Integer

The ID of the Droplet

name String

The name of the Droplet.

tag String

A tag applied to the Droplet.

id number

The ID of the Droplet

name string

The name of the Droplet.

tag string

A tag applied to the Droplet.

id int

The ID of the Droplet

name str

The name of the Droplet.

tag str

A tag applied to the Droplet.

id Number

The ID of the Droplet

name String

The name of the Droplet.

tag String

A tag applied to the Droplet.

getDroplet Result

The following output properties are available:

Backups bool

Whether backups are enabled.

CreatedAt string
Disk int

The size of the Droplets disk in GB.

Id int
Image string

The Droplet image ID or slug.

Ipv4Address string

The Droplets public IPv4 address

Ipv4AddressPrivate string

The Droplets private IPv4 address

Ipv6 bool

Whether IPv6 is enabled.

Ipv6Address string

The Droplets public IPv6 address

Ipv6AddressPrivate string

The Droplets private IPv6 address

Locked bool

Whether the Droplet is locked.

Memory int

The amount of the Droplets memory in MB.

Monitoring bool

Whether monitoring agent is installed.

Name string
PriceHourly double

Droplet hourly price.

PriceMonthly double

Droplet monthly price.

PrivateNetworking bool

Whether private networks are enabled.

Region string

The region the Droplet is running in.

Size string

The unique slug that indentifies the type of Droplet.

Status string

The status of the Droplet.

Tags List<string>

A list of the tags associated to the Droplet.

Urn string

The uniform resource name of the Droplet

Vcpus int

The number of the Droplets virtual CPUs.

VolumeIds List<string>

List of the IDs of each volumes attached to the Droplet.

VpcUuid string

The ID of the VPC where the Droplet is located.

Tag string
Backups bool

Whether backups are enabled.

CreatedAt string
Disk int

The size of the Droplets disk in GB.

Id int
Image string

The Droplet image ID or slug.

Ipv4Address string

The Droplets public IPv4 address

Ipv4AddressPrivate string

The Droplets private IPv4 address

Ipv6 bool

Whether IPv6 is enabled.

Ipv6Address string

The Droplets public IPv6 address

Ipv6AddressPrivate string

The Droplets private IPv6 address

Locked bool

Whether the Droplet is locked.

Memory int

The amount of the Droplets memory in MB.

Monitoring bool

Whether monitoring agent is installed.

Name string
PriceHourly float64

Droplet hourly price.

PriceMonthly float64

Droplet monthly price.

PrivateNetworking bool

Whether private networks are enabled.

Region string

The region the Droplet is running in.

Size string

The unique slug that indentifies the type of Droplet.

Status string

The status of the Droplet.

Tags []string

A list of the tags associated to the Droplet.

Urn string

The uniform resource name of the Droplet

Vcpus int

The number of the Droplets virtual CPUs.

VolumeIds []string

List of the IDs of each volumes attached to the Droplet.

VpcUuid string

The ID of the VPC where the Droplet is located.

Tag string
backups Boolean

Whether backups are enabled.

createdAt String
disk Integer

The size of the Droplets disk in GB.

id Integer
image String

The Droplet image ID or slug.

ipv4Address String

The Droplets public IPv4 address

ipv4AddressPrivate String

The Droplets private IPv4 address

ipv6 Boolean

Whether IPv6 is enabled.

ipv6Address String

The Droplets public IPv6 address

ipv6AddressPrivate String

The Droplets private IPv6 address

locked Boolean

Whether the Droplet is locked.

memory Integer

The amount of the Droplets memory in MB.

monitoring Boolean

Whether monitoring agent is installed.

name String
priceHourly Double

Droplet hourly price.

priceMonthly Double

Droplet monthly price.

privateNetworking Boolean

Whether private networks are enabled.

region String

The region the Droplet is running in.

size String

The unique slug that indentifies the type of Droplet.

status String

The status of the Droplet.

tags List<String>

A list of the tags associated to the Droplet.

urn String

The uniform resource name of the Droplet

vcpus Integer

The number of the Droplets virtual CPUs.

volumeIds List<String>

List of the IDs of each volumes attached to the Droplet.

vpcUuid String

The ID of the VPC where the Droplet is located.

tag String
backups boolean

Whether backups are enabled.

createdAt string
disk number

The size of the Droplets disk in GB.

id number
image string

The Droplet image ID or slug.

ipv4Address string

The Droplets public IPv4 address

ipv4AddressPrivate string

The Droplets private IPv4 address

ipv6 boolean

Whether IPv6 is enabled.

ipv6Address string

The Droplets public IPv6 address

ipv6AddressPrivate string

The Droplets private IPv6 address

locked boolean

Whether the Droplet is locked.

memory number

The amount of the Droplets memory in MB.

monitoring boolean

Whether monitoring agent is installed.

name string
priceHourly number

Droplet hourly price.

priceMonthly number

Droplet monthly price.

privateNetworking boolean

Whether private networks are enabled.

region string

The region the Droplet is running in.

size string

The unique slug that indentifies the type of Droplet.

status string

The status of the Droplet.

tags string[]

A list of the tags associated to the Droplet.

urn string

The uniform resource name of the Droplet

vcpus number

The number of the Droplets virtual CPUs.

volumeIds string[]

List of the IDs of each volumes attached to the Droplet.

vpcUuid string

The ID of the VPC where the Droplet is located.

tag string
backups bool

Whether backups are enabled.

created_at str
disk int

The size of the Droplets disk in GB.

id int
image str

The Droplet image ID or slug.

ipv4_address str

The Droplets public IPv4 address

ipv4_address_private str

The Droplets private IPv4 address

ipv6 bool

Whether IPv6 is enabled.

ipv6_address str

The Droplets public IPv6 address

ipv6_address_private str

The Droplets private IPv6 address

locked bool

Whether the Droplet is locked.

memory int

The amount of the Droplets memory in MB.

monitoring bool

Whether monitoring agent is installed.

name str
price_hourly float

Droplet hourly price.

price_monthly float

Droplet monthly price.

private_networking bool

Whether private networks are enabled.

region str

The region the Droplet is running in.

size str

The unique slug that indentifies the type of Droplet.

status str

The status of the Droplet.

tags Sequence[str]

A list of the tags associated to the Droplet.

urn str

The uniform resource name of the Droplet

vcpus int

The number of the Droplets virtual CPUs.

volume_ids Sequence[str]

List of the IDs of each volumes attached to the Droplet.

vpc_uuid str

The ID of the VPC where the Droplet is located.

tag str
backups Boolean

Whether backups are enabled.

createdAt String
disk Number

The size of the Droplets disk in GB.

id Number
image String

The Droplet image ID or slug.

ipv4Address String

The Droplets public IPv4 address

ipv4AddressPrivate String

The Droplets private IPv4 address

ipv6 Boolean

Whether IPv6 is enabled.

ipv6Address String

The Droplets public IPv6 address

ipv6AddressPrivate String

The Droplets private IPv6 address

locked Boolean

Whether the Droplet is locked.

memory Number

The amount of the Droplets memory in MB.

monitoring Boolean

Whether monitoring agent is installed.

name String
priceHourly Number

Droplet hourly price.

priceMonthly Number

Droplet monthly price.

privateNetworking Boolean

Whether private networks are enabled.

region String

The region the Droplet is running in.

size String

The unique slug that indentifies the type of Droplet.

status String

The status of the Droplet.

tags List<String>

A list of the tags associated to the Droplet.

urn String

The uniform resource name of the Droplet

vcpus Number

The number of the Droplets virtual CPUs.

volumeIds List<String>

List of the IDs of each volumes attached to the Droplet.

vpcUuid String

The ID of the VPC where the Droplet is located.

tag 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.