aboutsummaryrefslogtreecommitdiff
path: root/terraform/conflatorio-prometheus/prometheus.tf
diff options
context:
space:
mode:
Diffstat (limited to 'terraform/conflatorio-prometheus/prometheus.tf')
-rw-r--r--terraform/conflatorio-prometheus/prometheus.tf66
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}"
+ }
+}