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.
Minimal versions:
- Terraform 0.11.7
- Docker engine 17.06.2-ce
- A scaleway account
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.
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]}"
}
MIT