aboutsummaryrefslogtreecommitdiff
path: root/terraform/hash-loki/loki.tf
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-12-22 19:30:15 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-12-22 19:30:15 +0100
commit979ec08d3d35118f106559dc59c1961cd3534ba7 (patch)
tree5eed6a91277cc0326f5a1d7273cd3f6a9d2a2a60 /terraform/hash-loki/loki.tf
parent98cd7c1de49237ebc88b08c81d5a1ec0f98864c6 (diff)
downloadinfra-979ec08d3d35118f106559dc59c1961cd3534ba7.tar.gz
infra-979ec08d3d35118f106559dc59c1961cd3534ba7.tar.bz2
infra-979ec08d3d35118f106559dc59c1961cd3534ba7.tar.xz
infra-979ec08d3d35118f106559dc59c1961cd3534ba7.zip
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
+ }
+}
+