colinwilson / terraform-hcloud-docker-host

Terraform module to deploy a single Docker host (in swarm mode) on Hetzner Cloud. A Hetzner Cloud volume is used as the Docker root directory.

Home Page:https://registry.terraform.io/modules/colinwilson/docker-host/hcloud/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terraform-hcloud-docker-host

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

Tutorial

Provision a Docker Swarm Host with Traefik (v2) on Hetzner Cloud using Terraform Modules - Part 1

Compatibility

This module is meant for use with Terraform 0.13 or higher.

Usage

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

Inputs

Required

Name Description Type Default Required
ssh_public_key SSH Public Key. string n/a yes

Optional

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

Outputs

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.

Requirements

These sections describe requirements for using this module.

Software

The following dependencies must be available:

Hetzner Cloud Account

A Hetzner Cloud account and API Token (with Read & Write permissions) to provision the resources of this module.

About

Terraform module to deploy a single Docker host (in swarm mode) on Hetzner Cloud. A Hetzner Cloud volume is used as the Docker root directory.

https://registry.terraform.io/modules/colinwilson/docker-host/hcloud/latest

License:Apache License 2.0


Languages

Language:HCL 100.0%