aboutsummaryrefslogtreecommitdiff
path: root/terraform/hash-loki/loki.tf
diff options
context:
space:
mode:
Diffstat (limited to 'terraform/hash-loki/loki.tf')
-rw-r--r--terraform/hash-loki/loki.tf48
1 files changed, 48 insertions, 0 deletions
diff --git a/terraform/hash-loki/loki.tf b/terraform/hash-loki/loki.tf
new file mode 100644
index 0000000..b7bb60b
--- /dev/null
+++ b/terraform/hash-loki/loki.tf
@@ -0,0 +1,48 @@
+resource "docker_image" "loki" {
+ name = "grafana/loki:3.2.1"
+}
+
+resource "docker_volume" "loki" {
+ name = "loki"
+}
+
+resource "docker_container" "loki" {
+ image = docker_image.loki.image_id
+ name = "loki"
+ privileged = false
+ must_run = true
+
+ network_mode = "bridge"
+
+ networks_advanced {
+ name = data.docker_network.traefik.name
+ }
+
+ networks_advanced {
+ name = data.docker_network.dn42.name
+ }
+
+ dynamic "labels" {
+ for_each = [
+ { label = "traefik.enable", value = "true" },
+ { label = "traefik.docker.network", value = data.docker_network.traefik.name },
+ { label = "traefik.http.routers.loki.rule", value = "Host(`loki.trygvis.io`)" },
+ { label = "traefik.http.routers.loki.entrypoints", value = "websecure" },
+ { label = "traefik.http.routers.loki.tls.certresolver", value = "linode" },
+ ]
+ content {
+ label = labels.value["label"]
+ value = labels.value["value"]
+ }
+ }
+
+ env = [
+ ]
+
+ volumes {
+ volume_name = docker_volume.loki.name
+ container_path = "/loki"
+ read_only = false
+ }
+}
+