resource "docker_image" "prometheus" { name = "prom/prometheus:v2.53.2" } resource "docker_volume" "prometheus" { name = "prometheus" } resource "docker_container" "prometheus" { image = docker_image.prometheus.image_id name = "prometheus" must_run = true env = [ ] networks_advanced { name = data.docker_network.private.name } # networks_advanced { # name = data.docker_network.traefik.name # } # dynamic "labels" { # for_each = [ # { label = "traefik.enable", value = "true" }, # { label = "traefik.docker.network", value = data.docker_network.traefik.name }, # { label = "traefik.http.routers.prometheus.rule", value = "Host(`prometheus.trygvis.io`)" }, # { label = "traefik.http.routers.prometheus.entrypoints", value = "websecure" }, # { label = "traefik.http.routers.prometheus.tls.certresolver", value = "linode" }, # ] # content { # label = labels.value["label"] # value = labels.value["value"] # } # } mounts { source = "${local.path}" target = "/etc/prometheus" type = "bind" } volumes { volume_name = docker_volume.prometheus.name read_only = false container_path = "/prometheus" } depends_on = [ null_resource.mkdir ] } locals { path = "/etc/docker-service/prometheus" } resource "null_resource" "mkdir" { triggers = { path = local.path } provisioner "local-exec" { command = "ssh conflatorio.vpn.trygvis.io sudo mkdir -p ${local.path}" } }