digitalocean.getDroplet
Explore with Pulumi AI
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 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),
};
});
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
})
}
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 System.Linq;
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, &digitalocean.LookupDropletArgs{
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 = digitalocean.getDroplet({
tag: "web",
});
variables:
example:
fn::invoke:
Function: digitalocean:getDroplet
Arguments:
tag: web
Get the Droplet by ID
using System.Collections.Generic;
using System.Linq;
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, &digitalocean.LookupDropletArgs{
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:
getDroplet Result
The following output properties are available:
- Backups bool
Whether backups are enabled.
- Created
At 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
- Ipv4Address
Private string The Droplets private IPv4 address
- Ipv6 bool
Whether IPv6 is enabled.
- Ipv6Address string
The Droplets public IPv6 address
- Ipv6Address
Private 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
- Price
Hourly double Droplet hourly price.
- Price
Monthly double Droplet monthly price.
- Private
Networking 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.
- 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.
- Volume
Ids List<string> List of the IDs of each volumes attached to the Droplet.
- Vpc
Uuid string The ID of the VPC where the Droplet is located.
- Tag string
- Backups bool
Whether backups are enabled.
- Created
At 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
- Ipv4Address
Private string The Droplets private IPv4 address
- Ipv6 bool
Whether IPv6 is enabled.
- Ipv6Address string
The Droplets public IPv6 address
- Ipv6Address
Private 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
- Price
Hourly float64 Droplet hourly price.
- Price
Monthly float64 Droplet monthly price.
- Private
Networking 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.
- []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.
- Volume
Ids []string List of the IDs of each volumes attached to the Droplet.
- Vpc
Uuid string The ID of the VPC where the Droplet is located.
- Tag string
- backups Boolean
Whether backups are enabled.
- created
At 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
- ipv4Address
Private String The Droplets private IPv4 address
- ipv6 Boolean
Whether IPv6 is enabled.
- ipv6Address String
The Droplets public IPv6 address
- ipv6Address
Private 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
- price
Hourly Double Droplet hourly price.
- price
Monthly Double Droplet monthly price.
- private
Networking 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.
- 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.
- volume
Ids List<String> List of the IDs of each volumes attached to the Droplet.
- vpc
Uuid String The ID of the VPC where the Droplet is located.
- tag String
- backups boolean
Whether backups are enabled.
- created
At 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
- ipv4Address
Private string The Droplets private IPv4 address
- ipv6 boolean
Whether IPv6 is enabled.
- ipv6Address string
The Droplets public IPv6 address
- ipv6Address
Private 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
- price
Hourly number Droplet hourly price.
- price
Monthly number Droplet monthly price.
- private
Networking 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.
- 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.
- volume
Ids string[] List of the IDs of each volumes attached to the Droplet.
- vpc
Uuid 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
The ID of the Droplet.
- image str
The Droplet image ID or slug.
- ipv4_
address str The Droplets public IPv4 address
- ipv4_
address_ strprivate The Droplets private IPv4 address
- ipv6 bool
Whether IPv6 is enabled.
- ipv6_
address str The Droplets public IPv6 address
- ipv6_
address_ strprivate 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.
- 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.
- created
At 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
- ipv4Address
Private String The Droplets private IPv4 address
- ipv6 Boolean
Whether IPv6 is enabled.
- ipv6Address String
The Droplets public IPv6 address
- ipv6Address
Private 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
- price
Hourly Number Droplet hourly price.
- price
Monthly Number Droplet monthly price.
- private
Networking 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.
- 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.
- volume
Ids List<String> List of the IDs of each volumes attached to the Droplet.
- vpc
Uuid String The ID of the VPC where the Droplet is located.
- tag String
Package Details
- Repository
- DigitalOcean pulumi/pulumi-digitalocean
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
digitalocean
Terraform Provider.