Skip to content

brucellino/terraform-digitalocean-consul

Repository files navigation

pre-commit pre-commit.ci status semantic-release: conventional

Terraform Module for Consul on Digital Ocean

This module creates a Consul cluster with agents and servers on Digital Ocean, using a load balancer as frontend.

It requires a Vault instance with Digital Ocean tokens in a KV store, and creates an ssh key by adding a GitHub user's public key.

Examples

The examples/ directory contains the example usage of this module. These examples show how to use the module in your project, and are also use for testing in CI/CD.

Requirements

Name Version
terraform >1.2.0
digitalocean >=2.21.0
http >=3.0.1
random >=3.3.2
vault >=3.8.0

Providers

Name Version
digitalocean >=2.21.0
http >=3.0.1
random >=3.3.2
vault >=3.8.0

Modules

No modules.

Resources

Name Type
digitalocean_domain.cluster resource
digitalocean_droplet.agent resource
digitalocean_droplet.server resource
digitalocean_firewall.consul resource
digitalocean_firewall.ssh resource
digitalocean_loadbalancer.external resource
digitalocean_project_resources.agent_droplets resource
digitalocean_project_resources.consul_volumes resource
digitalocean_project_resources.network resource
digitalocean_project_resources.server_droplets resource
digitalocean_record.server resource
digitalocean_ssh_key.consul resource
digitalocean_volume.consul_data resource
random_id.key resource
digitalocean_image.ubuntu data source
digitalocean_project.p data source
digitalocean_vpc.selected data source
http_http.consul_health data source
http_http.ssh_key data source
vault_generic_secret.join_token data source

Inputs

Name Description Type Default Required
agents number of agent instances number 7 no
consul_version Version of Consul to deploy string "1.15.1" no
datacenter Name of the Consul datacenter string "HashiDO" no
droplet_size Size of the droplet for Vault instances string "s-1vcpu-1gb" no
project_name Name of the project in digitalocean string "hashi" no
servers number of server instances number 3 no
ssh_inbound_source_cidrs List of CIDRs from which we will allow ssh connections on port 22 list(any) [] no
ssh_public_key_url URL of of the public ssh key to add to the droplet string "https://github.com/brucellino.keys" no
username Name of the non-root user to add string "hashiuser" no
vpc_name Name of the VPC we are deploying into string "hashi" no

Outputs

Name Description
agent_public_ips List of public IPs for the Consul agents
load_balancer_ip Public IP of the load balancer fronting the servers
server_public_ips List of public IPs for the Consul servers