Skip to content

Latest commit

 

History

History
116 lines (102 loc) · 8.46 KB

README.md

File metadata and controls

116 lines (102 loc) · 8.46 KB

terraform-digitalocean-droplet

Terraform module which creates Droplet(s) and optionally, Block Storage Volumes, Floating IPs, Load Balancers and DNS Records on DigitalOcean.

These types of resources are used:

Usage Examples

Some examples can be found in this repository:

Note that examples may create resources which can cost money. Run terraform destroy when you don't need these resources.

If you're looking to try Digitalocean out, sign up here and get $100 free credit.

Droplet Sizes

A map of name to Droplet sizes exists to make specifying Droplet sizes simpler:

Name Droplet Size
nano s-1vcpu-1gb
micro s-2vcpu-2gb
small s-2vcpu-4gb
medium s-4vcpu-8gb
large s-6vcpu-16gb
x-large s-8vcpu-32gb
xx-large s-16vcpu-64gb
xxx-large s-24vcpu-128gb
maximum s-32vcpu-192gb

See DigitalOcean Pricing for costs.

Providers

Name Version
digitalocean n/a

Inputs

Name Description Type Default Required
backups (Optional) Boolean controlling if backups are made. Defaults to false. bool false no
block_storage_attach (Optional) Whether to attach the volume using Terraform or not. bool true no
block_storage_count (Optional) A count of block storage volume resources to create. string "" no
block_storage_filesystem_label (Optional) Initial filesystem label for the block storage volume. string "data" no
block_storage_filesystem_type (Optional) Initial filesystem type (xfs or ext4) for the block storage volume. string "xfs" no
block_storage_name (Optional) Override filesystem name for the block storage volume. string "" no
block_storage_size (Required) The size of the block storage volume in GiB. If updated, can only be expanded. number 0 no
custom_image Whether the image is custom or not (an official image) bool false no
droplet_count The number of droplets / other resources to create number 1 no
droplet_name The name of the droplet. If more than one droplet it is appended with the count, examples: stg-web, stg-web-01, stg-web-02 any n/a yes
droplet_size the size slug of a droplet size string "micro" no
floating_ip (Optional) Boolean to control whether floating IPs should be created. bool false no
floating_ip_assign (Optional) Boolean controlling whether floatin IPs should be assigned to instances with Terraform. bool true no
floating_ip_count Number of floating IPs to create. string "" no
image_id The id of an image to use. string "" no
image_name The image name or slug to lookup. string "ubuntu-18-04-x64" no
ipv6 (Optional) Boolean controlling if IPv6 is enabled. Defaults to false. bool false no
loadbalancer Boolean to control whether to create a Load Balancer. bool false no
loadbalancer_algorithm The load balancing algorithm used to determine which backend Droplet will be selected by a client. It must be either round_robin or least_connections. string "round_robin" no
loadbalancer_forwarding_rule List of forwarding_rule maps to apply to the loadbalancer. map
{
"entry_port": 80,
"entry_protocol": "http",
"target_port": 80,
"target_protocol": "http",
"tls_passthrough": false
}
no
loadbalancer_healthcheck A healthcheck block to be assigned to the Load Balancer. Only 1 healthcheck is allowed. map
{
"check_interval_seconds": 10,
"healthy_threshold": 5,
"path": "/",
"port": 80,
"protocol": "http",
"response_timeout_seconds": 10,
"unhealthy_threshold": 3
}
no
loadbalancer_name Override Load Balancer name. string "" no
loadbalancer_redirect_http_to_https (Optional) A boolean value indicating whether HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. bool false no
loadbalancer_sticky_sessions A sticky_sessions block to be assigned to the Load Balancer. Only 1 sticky_sessions block is allowed. map
{
"cookie_name": null,
"cookie_ttl_seconds": null,
"type": "none"
}
no
loadbalancer_tag The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer. string "" no
monitoring (Optional) Boolean controlling whether monitoring agent is installed. Defaults to false. bool false no
number_format The number format used to output. string "%02d" no
private_domain (Optional) String containing the private DNS domain to create a record for the Droplets in. string "" no
private_networking (Optional) Boolean controlling if private networks are enabled. Defaults to false. bool false no
public_domain (Optional) String containing the public DNS domain to create a record for the Droplets in. string "" no
region The Digitalocean datacenter to create resources in. string "ams3" no
resize_disk (Optional) Boolean controlling whether to increase the disk size when resizing a Droplet. It defaults to true. When set to false, only the Droplet's RAM and CPU will be resized. Increasing a Droplet's disk size is a permanent change. Increasing only RAM and CPU is reversible. bool true no
ssh_keys (Optional) A list of SSH IDs or fingerprints to enable in the format [12345, 123456]. To retrieve this info, use a tool such as curl with the DigitalOcean API, to retrieve them. list [] no
tags (Optional) A list of the tags to label this Droplet. A tag resource must exist before it can be associated with a Droplet. list [] no
user_data (Optional) A string of the desired User Data for the Droplet. string "exit 0" no

Outputs

Name Description
droplet_id List of IDs of Droplets
droplet_ids List of associated Droplet IDs of Volumes
filesystem_type List of initial filesystem types of Volumes
floating_ip_address List of floating IP addresses created
image List of images of Droplets
ipv4_address List of public IPv4 addresses assigned to the Droplets
ipv4_address_private List of private IPv4 addresses assigned to the Droplets, if applicable
ipv6_address List of public IPv6 addresses assigned to the Droplets, if applicable
loadbalancer_id ID of the loadbalancer
loadbalancer_ip IP address of the loadbalancer
name List of names of Droplets
private_a List of Droplet private DNS A record FQDNs.
public_a List of Droplet public DNS A record FQDNs.
public_aaaa List of Droplet public DNS AAAA record FQDNs.
region List of regions of Droplets
size List of sizes of Droplets
tags List of tags of Droplets
volume_attachment_id List of IDs of Volume Attachments
volume_id List of IDs of Volumes