This module serves as a canonical foundation for higher level services.
Name | Version |
---|---|
terraform | ~> 1.2 |
docker | 3.0.2 |
null | 3.2.2 |
Name | Version |
---|---|
docker | 3.0.2 |
No modules.
Name | Type |
---|---|
docker_config.this | resource |
docker_secret.this | resource |
docker_service.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
args | (Optional) The arguments to pass to the docker image | list(string) |
null |
no |
auth | (Optional) The authentication for a private docker registry. auth = { server_address = The address of the server for the authentication against a private docker registry. username = The password. password = The username. } |
object({ |
null |
no |
command | (Optional) The command/entrypoint to be run in the image. According to the docker cli the override of the entrypoint is also passed to the command property and there is no entrypoint attribute in the ContainerSpec of the service. | list(string) |
null |
no |
configs | (Optional) A list of configs that will be created and mounted by the service. configs = [{ config_id = ID of the specific config that we're referencing file_name = Represents the final filename in the filesystem config_name = Name of the config that this references, but this is just provided for lookup/display purposes. The config in the reference will be identified by its ID file_gid = Represents the file GID. Defaults to '0'. file_mode = Represents represents the FileMode of the file. Defaults to '0o444'. file_uid = Represents the file UID. Defaults to '0'. }] |
set(object({ |
[] |
no |
constraints | (Optional) The container placement constraints | set(string) |
[] |
no |
env | (Optional) The environmental variables to pass to the docker image | map(string) |
null |
no |
healthcheck | healthcheck = { test = The test to be performed in CMD format. interval = Time between running the check (ms|s|m|h). Defaults to '0s'. timeout = Maximum time to allow one check to run (ms|s|m|h). Defaults to '0s'. retries = Consecutive failures needed to report unhealthy. Defaults to '0'. start_period = Start period for the container to initialize before counting retries towards unstable (ms|s|m|h). Defaults to '0s'. } |
object({ |
null |
no |
image | The docker image name excluding the image tag | string |
n/a | yes |
image_tag | (Optional) The image tag of the docker image. Defaults to: latest | string |
"latest" |
no |
labels | (Optional) Labels to add to the service and container | map(string) |
{} |
no |
limit | (Optional) The resources limit of service, memory unit is MB | object({ |
null |
no |
mode | (Optional) The service mode. Defaults to 'replicated' with replicas set to 1. type = { global = The global service mode. Defaults to 'false'. replicated = { replicas = The amount of replicas of the service. Defaults to '1'. } } |
object({ |
{ |
no |
mounts | (Optional) Mounts of this docker service. mounts = [{ target = Container path type = The mount type source = Mount source (e.g. a volume name, a host path) read_only = Whether the mount should be read-only tmpfs_options = { mode = The permission mode for the tmpfs mount in an integer size_bytes = The size for the tmpfs mount in bytes } volume_options = { driver_name = Name of the driver to use to create the volume driver_options = key/value map of driver specific options labels = [{ label = Name of the label value = Value of the label }] no_copy = Populate volume with data from the target. } }] |
set(object({ |
[] |
no |
name | The service name which must not be longer than 63 characters. This name will also be used as a network alias for all attached networks. | string |
n/a | yes |
namespace | (Optional) The namespace of Docker Swarm | string |
null |
no |
network_aliases | (Optional) Aliases (alternative hostnames) for this service on all specified networks. Other containers on the same network can use either the service name or this alias to connect to one of the service's containers. See https://docs.docker.com/compose/compose-file/compose-file-v3/#aliases for more information. | list(string) |
[] |
no |
networks | (Optional) Attaches this service to the following network IDs. You can also supply names but those will force replacement in the terraform state. | set(string) |
[] |
no |
ports | (Optional) The ports to expose on the swarm for the service. ports = [{ target_port = The port inside the container. name = A random name for the port. protocol = Represents the protocol of a port: tcp, udp or sctp. Defaults to 'tcp'. publish_mode = Represents the mode in which the port is to be published: 'ingress' or 'host'. Defaults to 'ingress'. published_port = The port on the swarm hosts. }] |
list(object({ |
[] |
no |
reservation | (Optional) The resource reservation of service, memory unit is MB | object({ |
null |
no |
restart_policy | (Optional) Restart policy for containers. restart_policy = { condition = Condition for restart; possible options are "none" which does not automatically restart, "on-failure" restarts on non-zero exit, "any" (default) restarts regardless of exit status. delay = Delay between restart attempts (default is 5s) (ms|s|m|h). max_attempts = How many times to attempt to restart a container before giving up (default: 0, i.e. never give up). If the restart does not succeed within the configured window, this attempt doesn't count toward the configured max_attempts value. For example, if max_attempts is set to '2', and the restart fails on the first attempt, more than two restarts must be attempted. window = The time window used to evaluate the restart policy (default value is 5s, 0 means unbounded) (ms|s|m|h). } |
object({ |
{ |
no |
secret_map | (Optional) Similar to the secrets variable but allows for docker secret creation from terraform resources. secret_map = { key = { file_name = Represents the final filename in the filesystem. secret_id = ID of the specific secret that we're referencing. file_gid = Represents the file GID. Defaults to '0'. file_mode = Represents represents the FileMode of the file. Defaults to '0o444'. file_uid = Represents the file UID. Defaults to '0'. secret_name = Name of the secret that this references, but this is just provided for lookup/display purposes. The config in the reference will be identified by its ID. } } |
map(object({ |
{} |
no |
secrets | (Optional) The secrets to create with and add to the docker container. Creates docker secrets from non-terraform-resources. | set(object({ |
[] |
no |
Name | Description |
---|---|
configs | The configs created with and for this base docker service. |
secrets | The secrets created with and for this base docker service. |
this | The output of the base docker service. |