Skip to main content

DigitalOcean Droplet - Terraform

Requirements

NameVersion
terraform>= 1.9
digitalocean~> 2.40

Providers

NameVersion
digitalocean~> 2.40

Modules

NameSourceVersion
ssh_key./modules/ssh_keyn/a
volume./modules/volumen/a

Resources

NameType
digitalocean_droplet.thisresource
digitalocean_reserved_ip.thisresource

Inputs

NameDescriptionTypeDefaultRequired
backupsBoolean controlling if backups are made.boolfalseno
droplet_agentA boolean indicating whether to install the DigitalOcean agent used for providing access to the Droplet web console in the control panel.booltrueno
graceful_shutdownA boolean indicating whether the droplet should be gracefully shut down before it is deleted.boolfalseno
imageThe Droplet image ID or slug. This could be either image ID or droplet snapshot ID.string"ubuntu-24-04-x64"no
ipv6Boolean controlling if IPv6 is enabled.boolfalseno
monitoringBoolean controlling whether monitoring agent is installed.boolfalseno
nameThe Droplet name.stringn/ayes
regionThe region where the Droplet will be created.stringn/ayes
reserved_ip_createBoolean controlling whether to create a reserved IP.boolfalseno
resize_diskBoolean controlling whether to increase the disk size when resizing a Droplet.booltrueno
sizeThe unique slug that identifies the type of Droplet.string"s-1vcpu-1gb"no
ssh_key_createA boolean indicating whether to create an SSH key.boolfalseno
ssh_keysA list of SSH key IDs or fingerprints to enable.list(string)[]no
tagsA list of the tags to be applied to this Droplet.list(string)[]no
user_dataA string of the desired User Data for the Droplet.stringnullno
volumesA list of volumes to attach to the Droplet.
list(object({
name = string
size = number
initial_filesystem_type = string
initial_filesystem_label = string
description = string
}))
[]no
vpc_uuidThe ID of the VPC where the Droplet will be located.stringnullno

Outputs

NameDescription
droplet_idThe ID of the droplet.
droplet_urnThe URN of the droplet.
reserved_ip_urnThe URN of the reserved IP.
ssh_keyThe SSH key.
volume_idsThe IDs of the volumes.
volume_urnsThe URNs of the volumes.