1. Packages
  2. DigitalOcean Provider
  3. API Docs
  4. getDroplet
DigitalOcean v4.41.0 published on Wednesday, Mar 26, 2025 by Pulumi

digitalocean.getDroplet

Explore with Pulumi AI

DigitalOcean v4.41.0 published on Wednesday, Mar 26, 2025 by Pulumi

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:

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);
Copy
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_droplet(name="web")
pulumi.export("dropletOutput", example.ipv4_address)
Copy
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, &digitalocean.LookupDropletArgs{
			Name: pulumi.StringRef("web"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("dropletOutput", example.Ipv4Address)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
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),
    };
});
Copy
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()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: digitalocean:getDroplet
      arguments:
        name: web
outputs:
  dropletOutput: ${example.ipv4Address}
Copy

Get the Droplet by tag:

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const example = digitalocean.getDroplet({
    tag: "web",
});
Copy
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_droplet(tag="web")
Copy
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, &digitalocean.LookupDropletArgs{
			Tag: pulumi.StringRef("web"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

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

});
Copy
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());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: digitalocean:getDroplet
      arguments:
        tag: web
Copy

Get the Droplet by ID:

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const example = digitalocean.getDroplet({
    id: exampleDigitaloceanKubernetesCluster.nodePool[0].nodes[0].dropletId,
});
Copy
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_droplet(id=example_digitalocean_kubernetes_cluster["nodePool"][0]["nodes"][0]["dropletId"])
Copy
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, &digitalocean.LookupDropletArgs{
			Id: pulumi.IntRef(exampleDigitaloceanKubernetesCluster.NodePool[0].Nodes[0].DropletId),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

return await Deployment.RunAsync(() => 
{
    var example = DigitalOcean.GetDroplet.Invoke(new()
    {
        Id = exampleDigitaloceanKubernetesCluster.NodePool[0].Nodes[0].DropletId,
    });

});
Copy
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(exampleDigitaloceanKubernetesCluster.nodePool()[0].nodes()[0].dropletId())
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: digitalocean:getDroplet
      arguments:
        id: ${exampleDigitaloceanKubernetesCluster.nodePool[0].nodes[0].dropletId}
Copy

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

> 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)
}
Copy
public static CompletableFuture<GetDropletResult> getDroplet(GetDropletArgs args, InvokeOptions options)
public static Output<GetDropletResult> getDroplet(GetDropletArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: digitalocean:index/getDroplet:getDroplet
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Gpu bool
A boolean value specifying whether or not to search GPU Droplets
Id int
The ID of the Droplet
Name string
The name of the Droplet.
Tag string

A tag applied to the Droplet.

To include GPU Droplets when searching by name, use:

Gpu bool
A boolean value specifying whether or not to search GPU Droplets
Id int
The ID of the Droplet
Name string
The name of the Droplet.
Tag string

A tag applied to the Droplet.

To include GPU Droplets when searching by name, use:

gpu Boolean
A boolean value specifying whether or not to search GPU Droplets
id Integer
The ID of the Droplet
name String
The name of the Droplet.
tag String

A tag applied to the Droplet.

To include GPU Droplets when searching by name, use:

gpu boolean
A boolean value specifying whether or not to search GPU Droplets
id number
The ID of the Droplet
name string
The name of the Droplet.
tag string

A tag applied to the Droplet.

To include GPU Droplets when searching by name, use:

gpu bool
A boolean value specifying whether or not to search GPU Droplets
id int
The ID of the Droplet
name str
The name of the Droplet.
tag str

A tag applied to the Droplet.

To include GPU Droplets when searching by name, use:

gpu Boolean
A boolean value specifying whether or not to search GPU Droplets
id Number
The ID of the Droplet
name String
The name of the Droplet.
tag String

A tag applied to the Droplet.

To include GPU Droplets when searching by name, use:

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
The ID of the Droplet.
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 identifies 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.
Gpu bool
Tag string
Backups bool
Whether backups are enabled.
CreatedAt string
Disk int
The size of the Droplets disk in GB.
Id int
The ID of the Droplet.
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 identifies 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.
Gpu bool
Tag string
backups Boolean
Whether backups are enabled.
createdAt String
disk Integer
The size of the Droplets disk in GB.
id Integer
The ID of the Droplet.
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 identifies 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.
gpu Boolean
tag String
backups boolean
Whether backups are enabled.
createdAt string
disk number
The size of the Droplets disk in GB.
id number
The ID of the Droplet.
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 identifies 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.
gpu boolean
tag string
backups bool
Whether backups are enabled.
created_at str
disk int
The size of the Droplets disk in GB.
id int
The ID of the Droplet.
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 identifies 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.
gpu bool
tag str
backups Boolean
Whether backups are enabled.
createdAt String
disk Number
The size of the Droplets disk in GB.
id Number
The ID of the Droplet.
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 identifies 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.
gpu Boolean
tag String

Package Details

Repository
DigitalOcean pulumi/pulumi-digitalocean
License
Apache-2.0
Notes
This Pulumi package is based on the digitalocean Terraform Provider.
DigitalOcean v4.41.0 published on Wednesday, Mar 26, 2025 by Pulumi