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 Terraform 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.
Get the Droplet by name:
data "digitalocean_droplet" "example" {
name = "web"
}
output "droplet_output" {
value = data.digitalocean_droplet.example.ipv4_address
}
Get the Droplet by tag:
data "digitalocean_droplet" "example" {
tag = "web"
}
Get the Droplet by ID:
data "digitalocean_droplet" "example" {
id = digitalocean_kubernetes_cluster.example.node_pool[0].nodes[0].droplet_id
}
One of the following arguments must be provided:
id
- (Optional) The ID of the Dropletname
- (Optional) The name of the Droplet.tag
- (Optional) A tag applied to the Droplet.To include GPU Droplets when searching by name, use:
gpu
- (Optional) A boolean value specifying whether or not to search GPU DropletsThe following attributes are exported:
id
: The ID of the Droplet.urn
- The uniform resource name of the Dropletregion
- The region the Droplet is running in.image
- The Droplet image ID or slug.size
- The unique slug that identifies the type of Droplet.disk
- The size of the Droplets disk in GB.vcpus
- The number of the Droplets virtual CPUs.memory
- The amount of the Droplets memory in MB.price_hourly
- Droplet hourly price.price_monthly
- Droplet monthly price.status
- The status of the Droplet.locked
- Whether the Droplet is locked.ipv6_address
- The Droplets public IPv6 addressipv6_address_private
- The Droplets private IPv6 addressipv4_address
- The Droplets public IPv4 addressipv4_address_private
- The Droplets private IPv4 addressbackups
- Whether backups are enabled.ipv6
- Whether IPv6 is enabled.private_networking
- Whether private networks are enabled.monitoring
- Whether monitoring agent is installed.volume_ids
- List of the IDs of each volumes attached to the Droplet.tags
- A list of the tags associated to the Droplet.vpc_uuid
- The ID of the VPC where the Droplet is located.