Skip to content
Terraform module to create a docker swarm cluster on Scaleway.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example/basic
scripts
.gitignore
LICENSE
README.md
main.tf
managers.tf
output.tf
variables.tf
workers.tf

README.md

Terraform Scaleway Docker Swarm Module

This module creates a docker swarm cluster with TLS enabled on Scaleway.

It does not create network security groups, docker access is secured using TLS certificates but creating network security groups is up to you.

Still to do:

  • Support choosing a key file for ssh. Right now it trusts you local ssh agent.
  • Support additional volumes.
  • Support bastion hosts to provision instances.

Dependencies

Minimal versions:

  • Terraform 0.11.7
  • Docker engine 17.06.2-ce
  • A scaleway account

Usage

Example usage of the module.

# scaleway access variables
variable "organization" {}
variable "token" {}

module "docker-swarm" {
  source="github.com/diogok/terraform-scaleway-docker-swarm" 

  name="demo"

  manager_count=1
  worker_count=3
  
  label="demo"
  
  organization="${var.organization}"
  token="${var.token}"
}

output "managers" {
  value="${module.docker-swarm.swarm_managers}"
}

output "workers" {
  value="${module.docker-swarm.swarm_workers}"
}

output "docker-env" {
   value="${module.docker-swarm.docker-env}"
}

You can control the swarm manager with this command:

$(terraform output docker-env)

This will export properlty DOCKER_HOST , DOCKER_TLS_VERIFY and DOCKER_CERT_PATH to securily connect docker to the manager.

It will generate the TLS certs at your local "keys" folder, on folder for each name and one folder for each IP of a manager. Only manager get docker daemon exposed.

Joining an existing swarm

module "docker-swarm-2" {
  source="github.com/diogok/terraform-scaleway-docker-swarm" 

  name="demo"

  manager_count=0
  worker_count=1
  
  label="second=true"
  
  organization="${var.organization}"
  token="${var.token}"

  join_existing_swarm=true
  existing_swarm_manager="${module.docker-swarm.managers[0]}"
}

License

MIT

You can’t perform that action at this time.