We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker_service
terraform { required_providers { docker = { source = "kreuzwerker/docker" } } } variable "swarm_host" { type = string } provider "docker" { host = var.swarm_host ssh_opts = ["-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null"] } resource "docker_volume" "caddy" { name = "caddy" } resource "docker_network" "caddy" { name = "caddy" driver = "overlay" } resource "docker_image" "caddy" { name = "lucaslorentz/caddy-docker-proxy:2.9.1" keep_locally = false } resource "docker_image" "nginx" { name = "nginx:1.27.1" keep_locally = false } resource "docker_service" "caddy" { name = "caddy" depends_on = [docker_volume.caddy] task_spec { force_update = 0 networks_advanced { name = docker_network.caddy.name } container_spec { image = docker_image.caddy.image_id env = { CADDY_DOCKER_MODE = "swarm" DOCKER_HOST = "unix:///var/run/docker.sock" CADDY_INGRESS_NETWORK = docker_network.caddy.name CADDY_ACME_EMAIL = "[email protected]", CADDY_STORAGE = "/data/caddy" } mounts { type = "bind" target = "/var/run/docker.sock" source = "/var/run/docker.sock" } } } endpoint_spec { ports { target_port = "80" published_port = "80" } ports { target_port = "443" published_port = "443" } } } resource "docker_service" "app" { name = "app" task_spec { force_update = 0 networks_advanced { name = docker_network.caddy.name } container_spec { image = docker_image.nginx.image_id labels { label = "caddy" value = "architech.bg" } labels { label = "caddy.reverse_proxy" value = "{{upstreams 80}}" } labels { label = "caddy.tls" value = "internal" } } } mode { replicated { replicas = 2 } } }
Second terraform apply must not recreate services.
terraform apply
Second terraform apply recreates services.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Community Note
Terraform (and docker Provider) Version
Affected Resource(s)
docker_service
Terraform Configuration Files
Expected Behaviour
Second
terraform apply
must not recreate services.Actual Behaviour
Second
terraform apply
recreates services.Steps to Reproduce
terraform apply
The text was updated successfully, but these errors were encountered: