Docker Traefik Terraform module
Terraform module which deploys a Docker service
on Traefik with zero downtime (red/black).
Name |
Description |
Type |
Default |
Required |
basic_auth_users |
List of authorized users. |
list(string) |
[] |
no |
cert_sans |
List of SANs for the cert. |
list(string) |
[] |
no |
certresolver |
Name of certificate resolver. |
string |
null |
no |
command |
The command to use to start the container. |
list(string) |
[] |
no |
container_port |
Explicit container port to forward traffic to. |
number |
null |
no |
cpu_set |
A comma-separated list or hyphen-separated range of CPUs a container can use. |
string |
null |
no |
cpu_shares |
CPU shares (relative weight) for the container. |
number |
null |
no |
deregistration_delay |
Amount of seconds to wait for open connections to drain before stopping the container. |
number |
60 |
no |
entrypoint |
The command to use as the Entrypoint for the container. |
list(string) |
[] |
no |
environment |
The environment variables to pass to a container. |
map(string) |
{} |
no |
healthcheck |
The container health check command and associated configuration parameters for the container. |
object({ command = list(string) interval = optional(number, 30) timeout = optional(number, 30) start_period = optional(number, 0) retries = optional(number, 3) }) |
null |
no |
http_entrypoints |
List of HTTP entrypoints. |
list(string) |
[] |
no |
http_middlewares |
List of HTTP middlewares. |
list(string) |
[] |
no |
https_entrypoints |
List of HTTPS entrypoints. |
list(string) |
[] |
no |
https_middlewares |
List of HTTPS middlewares. |
list(string) |
[] |
no |
image |
The image used to start a container. |
string |
n/a |
yes |
labels |
Additional lables to set. |
map(string) |
{} |
no |
listener_rule |
Sets the routing rule. |
string |
n/a |
yes |
memory |
The amount (in MiB) of memory to present to the container. |
number |
n/a |
yes |
mounts |
List for mounts to be added to containers created as part of the service. |
list(object({ type = string target = string source = optional(string, null) read_only = optional(bool, false) })) |
[] |
no |
name |
The name of the service. |
string |
n/a |
yes |
publish |
List of ports to publish. |
list(object({ internal = number external = number ip = optional(string, null) protocol = optional(string, "tcp") })) |
[] |
no |
revision |
Revision number of this service. |
number |
n/a |
yes |
service_network |
Name of the service docker network. |
string |
null |
no |
traefik_network |
Name of the Traefik docker network. |
string |
null |
no |
volumes |
List for mounting volumes in the container. |
list(object({ container_path = optional(string, null) from_container = optional(string, null) host_path = optional(string, null) read_only = optional(bool, false) volume_name = optional(string, null) })) |
[] |
no |
$ brew install pre-commit terraform-docs
$ pip install --user pre-commit
$ ver="$(curl -sSLf https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | jq -r '.tag_name')"; \
curl -sSLO \
"https://terraform-docs.io/dl/${ver}/terraform-docs-${ver}-$(uname)-amd64.tar.gz" && \
tar xf terraform-docs*.tar.gz && \
chmod +x terraform-docs && \
sudo mv terraform-docs /usr/local/bin/
Run once in this directory:
Optionally you can trigger the hooks before committing: