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

Use the filter block with a key string and values list to filter images. For example to find all Droplets with size s-1vcpu-1gb:

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

Return

A collection of values returned by getDroplets.

Parameters

argument

A collection of arguments for invoking getDroplets.


suspend fun getDroplets(filters: List<GetDropletsFilter>? = null, sorts: List<GetDropletsSort>? = null): GetDropletsResult

Return

A collection of values returned by getDroplets.

See also

Parameters

filters

Filter the results. The filter block is documented below.

sorts

Sort the results. The sort block is documented below.


suspend fun getDroplets(argument: suspend GetDropletsPlainArgsBuilder.() -> Unit): GetDropletsResult

Return

A collection of values returned by getDroplets.

See also

Parameters

argument

Builder for com.pulumi.digitalocean.kotlin.inputs.GetDropletsPlainArgs.