diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2024-08-22 21:45:35 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2024-08-22 21:45:35 +0200 |
commit | b1892d6517abaf89d5deb624712b310ce3e1a5b9 (patch) | |
tree | a89b2ff710dff84e0b89326ee645b25529f74fb7 /terraform/conflatorio-prometheus/prometheus.tf | |
parent | 4c53a89d4102c9cbb512ee3cb4afe90e24605239 (diff) | |
download | infra-b1892d6517abaf89d5deb624712b310ce3e1a5b9.tar.gz infra-b1892d6517abaf89d5deb624712b310ce3e1a5b9.tar.bz2 infra-b1892d6517abaf89d5deb624712b310ce3e1a5b9.tar.xz infra-b1892d6517abaf89d5deb624712b310ce3e1a5b9.zip |
grafana & prometheus
Diffstat (limited to 'terraform/conflatorio-prometheus/prometheus.tf')
-rw-r--r-- | terraform/conflatorio-prometheus/prometheus.tf | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/terraform/conflatorio-prometheus/prometheus.tf b/terraform/conflatorio-prometheus/prometheus.tf new file mode 100644 index 0000000..04dd406 --- /dev/null +++ b/terraform/conflatorio-prometheus/prometheus.tf @@ -0,0 +1,66 @@ +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}" + } +} |