A Terraform module to deploy a single Docker host (in swarm mode) on Hetzner Cloud. A separate Hetzner Cloud volume is also created, attached and configured as the Docker root directory. See the variables file for the available configuration settings.
The resources/services/activations/deletions that this module will create/trigger are:
- Create a server and cloud volume on the Hetzner Cloud Platform
- Create or use an existing SSH Public Key
- Installer Docker Compose, Docker and enable Docker Swarm mode
Provision a Docker Swarm Host with Traefik (v2) on Hetzner Cloud using Terraform Modules - Part 1
This module is meant for use with Terraform 0.13 or higher.
Basic usage of this module is as follows:
module "hcloud-docker-host" {
source = "github.com/colinwilson/terraform-hcloud-docker-host"
version = "~> 0.1.4"
server = {
name = "docker-swarm-host-01"
server_type = "cx11"
image = "ubuntu-20.04"
location = "hel1"
backups = false
}
ssh_public_key_name = "my_ssh_key"
ssh_public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJNcwP5mhs5/F2T9GFHmg4z6E6sbOG+Ynx2iPERKeOGm"
volume_size = 20
volume_filesystem = "xfs"
}
A Functional example is included in the examples directory or clone the docker-host branch here
Name | Description | Type | Default | Required |
---|---|---|---|---|
ssh_public_key | SSH Public Key. | string | n/a | yes |
Name | Description | Type | Default | Required |
---|---|---|---|---|
server | Server configuration map. | map(any) | {name = "docker-host", server_type = "cx11", image = "ubuntu-20.04", location = "nbg1", backups = false} |
no |
docker_compose_version | Docker compose version to install. | string | "2.17.3" |
no |
volume_size | Volume size (GB) (min 10, max 10240). | number | 10 |
no |
volume_filesystem | Volume filesystem. | string | "xfs" |
no |
ssh_public_key_name | SSH Public Key Name. | string | "default" |
no |
Name | Description |
---|---|
ipv4_address | IPv4 address of server. |
volume_size | Size of dedicated Docker data root volume. |
volume_mount_point | Mount point of dedicated Docker volume. |
These sections describe requirements for using this module.
The following dependencies must be available:
- Terraform v0.13
- Terraform Provider for Hetzner Cloud version v1.2.x
A Hetzner Cloud account and API Token (with Read & Write permissions) to provision the resources of this module.