DigitalOcean

Pulumi Official
Package maintained by Pulumi
v4.15.1 published on Thursday, Aug 18, 2022 by Pulumi

getDroplets

Get information on Droplets for use in other resources, with the ability to filter and sort the results. If no filters are specified, all Droplets will be returned.

This data source is useful if the Droplets in question are not managed by the provider or you need to utilize any of the Droplets’ data.

Note: You can use the digitalocean.Droplet data source to obtain metadata about a single Droplet if you already know the id, unique name, or unique tag to retrieve.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var small = DigitalOcean.GetDroplets.Invoke(new()
    {
        Filters = new[]
        {
            new DigitalOcean.Inputs.GetDropletsFilterInputArgs
            {
                Key = "size",
                Values = new[]
                {
                    "s-1vcpu-1gb",
                },
            },
        },
    });

});
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.GetDroplets(ctx, &GetDropletsArgs{
			Filters: []GetDropletsFilter{
				GetDropletsFilter{
					Key: "size",
					Values: []string{
						"s-1vcpu-1gb",
					},
				},
			},
		}, 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.GetDropletsArgs;
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 small = DigitaloceanFunctions.getDroplets(GetDropletsArgs.builder()
            .filters(GetDropletsFilterArgs.builder()
                .key("size")
                .values("s-1vcpu-1gb")
                .build())
            .build());

    }
}
import pulumi
import pulumi_digitalocean as digitalocean

small = digitalocean.get_droplets(filters=[digitalocean.GetDropletsFilterArgs(
    key="size",
    values=["s-1vcpu-1gb"],
)])
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const small = pulumi.output(digitalocean.getDroplets({
    filters: [{
        key: "size",
        values: ["s-1vcpu-1gb"],
    }],
}));
variables:
  small:
    Fn::Invoke:
      Function: digitalocean:getDroplets
      Arguments:
        filters:
          - key: size
            values:
              - s-1vcpu-1gb

Using getDroplets

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 getDroplets(args: GetDropletsArgs, opts?: InvokeOptions): Promise<GetDropletsResult>
function getDropletsOutput(args: GetDropletsOutputArgs, opts?: InvokeOptions): Output<GetDropletsResult>
def get_droplets(filters: Optional[Sequence[GetDropletsFilter]] = None,
                 sorts: Optional[Sequence[GetDropletsSort]] = None,
                 opts: Optional[InvokeOptions] = None) -> GetDropletsResult
def get_droplets_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetDropletsFilterArgs]]]] = None,
                 sorts: Optional[pulumi.Input[Sequence[pulumi.Input[GetDropletsSortArgs]]]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetDropletsResult]
func GetDroplets(ctx *Context, args *GetDropletsArgs, opts ...InvokeOption) (*GetDropletsResult, error)
func GetDropletsOutput(ctx *Context, args *GetDropletsOutputArgs, opts ...InvokeOption) GetDropletsResultOutput

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

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

The following arguments are supported:

Filters List<Pulumi.DigitalOcean.Inputs.GetDropletsFilter>

Filter the results. The filter block is documented below.

Sorts List<Pulumi.DigitalOcean.Inputs.GetDropletsSort>

Sort the results. The sort block is documented below.

Filters []GetDropletsFilter

Filter the results. The filter block is documented below.

Sorts []GetDropletsSort

Sort the results. The sort block is documented below.

filters List<GetDropletsFilter>

Filter the results. The filter block is documented below.

sorts List<GetDropletsSort>

Sort the results. The sort block is documented below.

filters GetDropletsFilter[]

Filter the results. The filter block is documented below.

sorts GetDropletsSort[]

Sort the results. The sort block is documented below.

filters Sequence[GetDropletsFilter]

Filter the results. The filter block is documented below.

sorts Sequence[GetDropletsSort]

Sort the results. The sort block is documented below.

filters List<Property Map>

Filter the results. The filter block is documented below.

sorts List<Property Map>

Sort the results. The sort block is documented below.

getDroplets Result

The following output properties are available:

Droplets List<Pulumi.DigitalOcean.Outputs.GetDropletsDroplet>

A list of Droplets satisfying any filter and sort criteria. Each Droplet has the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Filters List<Pulumi.DigitalOcean.Outputs.GetDropletsFilter>
Sorts List<Pulumi.DigitalOcean.Outputs.GetDropletsSort>
Droplets []GetDropletsDroplet

A list of Droplets satisfying any filter and sort criteria. Each Droplet has the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Filters []GetDropletsFilter
Sorts []GetDropletsSort
droplets List<GetDropletsDroplet>

A list of Droplets satisfying any filter and sort criteria. Each Droplet has the following attributes:

id String

The provider-assigned unique ID for this managed resource.

filters List<GetDropletsFilter>
sorts List<GetDropletsSort>
droplets GetDropletsDroplet[]

A list of Droplets satisfying any filter and sort criteria. Each Droplet has the following attributes:

id string

The provider-assigned unique ID for this managed resource.

filters GetDropletsFilter[]
sorts GetDropletsSort[]
droplets Sequence[GetDropletsDroplet]

A list of Droplets satisfying any filter and sort criteria. Each Droplet has the following attributes:

id str

The provider-assigned unique ID for this managed resource.

filters Sequence[GetDropletsFilter]
sorts Sequence[GetDropletsSort]
droplets List<Property Map>

A list of Droplets satisfying any filter and sort criteria. Each Droplet has the following attributes:

id String

The provider-assigned unique ID for this managed resource.

filters List<Property Map>
sorts List<Property Map>

Supporting Types

GetDropletsDroplet

Backups bool

Whether backups are enabled.

CreatedAt string
Disk int

The size of the Droplet's disk in GB.

Id int

The ID of the Droplet.

Image string

The Droplet image ID or slug.

Ipv4Address string

The Droplet's public IPv4 address

Ipv4AddressPrivate string

The Droplet's private IPv4 address

Ipv6 bool

Whether IPv6 is enabled.

Ipv6Address string

The Droplet's public IPv6 address

Ipv6AddressPrivate string

The Droplet's private IPv6 address

Locked bool

Whether the Droplet is locked.

Memory int

The amount of the Droplet's 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 Droplet's 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.

Backups bool

Whether backups are enabled.

CreatedAt string
Disk int

The size of the Droplet's disk in GB.

Id int

The ID of the Droplet.

Image string

The Droplet image ID or slug.

Ipv4Address string

The Droplet's public IPv4 address

Ipv4AddressPrivate string

The Droplet's private IPv4 address

Ipv6 bool

Whether IPv6 is enabled.

Ipv6Address string

The Droplet's public IPv6 address

Ipv6AddressPrivate string

The Droplet's private IPv6 address

Locked bool

Whether the Droplet is locked.

Memory int

The amount of the Droplet's 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 Droplet's 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.

backups Boolean

Whether backups are enabled.

createdAt String
disk Integer

The size of the Droplet's disk in GB.

id Integer

The ID of the Droplet.

image String

The Droplet image ID or slug.

ipv4Address String

The Droplet's public IPv4 address

ipv4AddressPrivate String

The Droplet's private IPv4 address

ipv6 Boolean

Whether IPv6 is enabled.

ipv6Address String

The Droplet's public IPv6 address

ipv6AddressPrivate String

The Droplet's private IPv6 address

locked Boolean

Whether the Droplet is locked.

memory Integer

The amount of the Droplet's 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 Droplet's 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.

backups boolean

Whether backups are enabled.

createdAt string
disk number

The size of the Droplet's disk in GB.

id number

The ID of the Droplet.

image string

The Droplet image ID or slug.

ipv4Address string

The Droplet's public IPv4 address

ipv4AddressPrivate string

The Droplet's private IPv4 address

ipv6 boolean

Whether IPv6 is enabled.

ipv6Address string

The Droplet's public IPv6 address

ipv6AddressPrivate string

The Droplet's private IPv6 address

locked boolean

Whether the Droplet is locked.

memory number

The amount of the Droplet's 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 Droplet's 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.

backups bool

Whether backups are enabled.

created_at str
disk int

The size of the Droplet's disk in GB.

id int

The ID of the Droplet.

image str

The Droplet image ID or slug.

ipv4_address str

The Droplet's public IPv4 address

ipv4_address_private str

The Droplet's private IPv4 address

ipv6 bool

Whether IPv6 is enabled.

ipv6_address str

The Droplet's public IPv6 address

ipv6_address_private str

The Droplet's private IPv6 address

locked bool

Whether the Droplet is locked.

memory int

The amount of the Droplet's 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 Droplet's 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.

backups Boolean

Whether backups are enabled.

createdAt String
disk Number

The size of the Droplet's disk in GB.

id Number

The ID of the Droplet.

image String

The Droplet image ID or slug.

ipv4Address String

The Droplet's public IPv4 address

ipv4AddressPrivate String

The Droplet's private IPv4 address

ipv6 Boolean

Whether IPv6 is enabled.

ipv6Address String

The Droplet's public IPv6 address

ipv6AddressPrivate String

The Droplet's private IPv6 address

locked Boolean

Whether the Droplet is locked.

memory Number

The amount of the Droplet's 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 Droplet's 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.

GetDropletsFilter

Key string

Filter the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, tags, urn, vcpus, volume_ids, or vpc_uuid.

Values List<string>

A list of values to match against the key field. Only retrieves Droplets where the key field takes on one or more of the values provided here.

All bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

MatchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

Key string

Filter the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, tags, urn, vcpus, volume_ids, or vpc_uuid.

Values []string

A list of values to match against the key field. Only retrieves Droplets where the key field takes on one or more of the values provided here.

All bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

MatchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key String

Filter the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, tags, urn, vcpus, volume_ids, or vpc_uuid.

values List<String>

A list of values to match against the key field. Only retrieves Droplets where the key field takes on one or more of the values provided here.

all Boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy String

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key string

Filter the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, tags, urn, vcpus, volume_ids, or vpc_uuid.

values string[]

A list of values to match against the key field. Only retrieves Droplets where the key field takes on one or more of the values provided here.

all boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy string

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key str

Filter the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, tags, urn, vcpus, volume_ids, or vpc_uuid.

values Sequence[str]

A list of values to match against the key field. Only retrieves Droplets where the key field takes on one or more of the values provided here.

all bool

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

match_by str

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

key String

Filter the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, tags, urn, vcpus, volume_ids, or vpc_uuid.

values List<String>

A list of values to match against the key field. Only retrieves Droplets where the key field takes on one or more of the values provided here.

all Boolean

Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.

matchBy String

One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

GetDropletsSort

Key string

Sort the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, urn, vcpus, or vpc_uuid.

Direction string

The sort direction. This may be either asc or desc.

Key string

Sort the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, urn, vcpus, or vpc_uuid.

Direction string

The sort direction. This may be either asc or desc.

key String

Sort the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, urn, vcpus, or vpc_uuid.

direction String

The sort direction. This may be either asc or desc.

key string

Sort the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, urn, vcpus, or vpc_uuid.

direction string

The sort direction. This may be either asc or desc.

key str

Sort the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, urn, vcpus, or vpc_uuid.

direction str

The sort direction. This may be either asc or desc.

key String

Sort the Droplets by this key. This may be one of backups, created_at, disk, id, image, ipv4_address, ipv4_address_private, ipv6, ipv6_address, ipv6_address_private, locked, memory, monitoring, name, price_hourly, price_monthly, private_networking, region, size, status, urn, vcpus, or vpc_uuid.

direction String

The sort direction. This may be either asc or desc.

Package Details

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

This Pulumi package is based on the digitalocean Terraform Provider.