module
alinefr/module/docker
Module to create & maintain docker resources from terraform
Terraform Docker Module Overview Terraform docker module is a module to help docker maintenance over terraform. It should replace other means of docker maintenance like docker-compose. There are several advantages of maintaining docker on terraform. Infrastructure as code. CI/CD. Many CI tools offers some way to automate terraform execution. * Remote execution. You don't need to manually ssh into servers. This module uses under the hood Docker Provider. Example: ``hcl provider "docker" { host = "tcp://192.168.0.100:2375/" } module "proxy" { source = "alinefr/module/docker" version = " " image = "masnagam/nginx-proxy:latest" container_name = "proxy" restart_policy = "always" docker_networks = { "proxy-tier" = { ipam_config = { aux_address = {} gateway = "10.0.20.1" subnet = "10.0.20.0/24" }
| Name | Type | Description | Default |
|---|---|---|---|
| environment | map(string) | Add environment variables | null |
| command | list(string) | Override the default command | null |
| ports | list(object({ internal = n | Expose ports | null |
| devices | map(object({ container_pat | Device mappings | {} |
| healthcheck | object({ interval = st | Test to check if container is healthy | null |
| docker_networks | any | List of custom networks to create ```hcl docker_networks = [ { name = "pro | [] |
| init | bool | If init process should be used as the PID 1 in the container | false |
| container_name | string | Custom container name | null |
| networks_advanced | any | Advanced network options for the container ```hcl networks_advanced = [ { | null |
| host_paths | map(object({ container_pat | Mount host paths | {} |
| volumes_from_containers | list(any) | Mount volumes from another container | null |
| capabilities | object({ add = list(strin | Add or drop container capabilities | null |
| image | string | Specify the image to start the container from. Can either be a repository/tag or | null |
| existing_image | string | Specify an existing image from another module | null |
| dns | list(string) | Set custom dns servers for the container | null |
| privileged | bool | Give extended privileges to this container | false |
| network_mode | string | Specify a custom network mode | null |
| entrypoint | list(string) | Override the default entrypoint | null |
| named_volumes | map(object({ container_pat | Mount named volumes | {} |
| hostname | string | Set docker hostname | null |
dnsportsvolumesdocker_volumeshealthcheckinithostnamecommandimage_idnetwork_modeentrypointdevicescapabilitiesnetworks_advanceddocker_networksenvironmentimage_namerestartprivilegedcontainer_nameworking_dir