From ebe35b94b059343849e0c428ee69378190f25030 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 23 Oct 2023 15:41:46 +0200 Subject: grafana/traefik --- terraform/conflatorio-docker/network.tf | 9 +++++++++ terraform/conflatorio-docker/traefik.tf | 17 ++--------------- terraform/grafana/grafana.tf | 9 +++++---- terraform/grafana/main.tf | 8 ++++++++ 4 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 terraform/conflatorio-docker/network.tf (limited to 'terraform') diff --git a/terraform/conflatorio-docker/network.tf b/terraform/conflatorio-docker/network.tf new file mode 100644 index 0000000..32e1bfb --- /dev/null +++ b/terraform/conflatorio-docker/network.tf @@ -0,0 +1,9 @@ +resource "docker_network" "public" { + name = "public" + + ipv6 = true + + ipam_config { + subnet = "fdf3:aad9:a885:77dd:bbbb::/120" + } +} diff --git a/terraform/conflatorio-docker/traefik.tf b/terraform/conflatorio-docker/traefik.tf index ebc1ea0..8613394 100644 --- a/terraform/conflatorio-docker/traefik.tf +++ b/terraform/conflatorio-docker/traefik.tf @@ -1,10 +1,5 @@ resource "docker_network" "traefik" { name = "traefik" - ipv6 = true - - ipam_config { - subnet = "fdf3:aad9:a885:77dd:aaaa::/120" - } } resource "docker_image" "traefik" { @@ -21,16 +16,8 @@ resource "docker_container" "traefik" { name = docker_network.traefik.name } -# ports { -# internal = 80 -# external = 80 -# ip = "192.168.10.147" -# } -# -# ports { -# internal = 443 -# external = 443 -# ip = "192.168.10.147" +# networks_advanced { +# name = docker_network.public.name # } ports { diff --git a/terraform/grafana/grafana.tf b/terraform/grafana/grafana.tf index d72d457..6d75da3 100644 --- a/terraform/grafana/grafana.tf +++ b/terraform/grafana/grafana.tf @@ -1,7 +1,3 @@ -data "docker_network" "traefik" { - name = "traefik" -} - resource "docker_image" "grafana" { name = "grafana/grafana-oss:10.1.5" } @@ -20,9 +16,14 @@ resource "docker_container" "grafana" { name = data.docker_network.traefik.name } + networks_advanced { + name = data.docker_network.public.name + } + dynamic "labels" { for_each = [ { label = "traefik.enable", value = "true" }, + { label = "traefik.docker.network", value = data.docker_network.traefik.name }, { label = "traefik.http.routers.grafana.rule", value = "Host(`grafana.vpn.trygvis.io`)" }, { label = "traefik.http.routers.grafana.entrypoints", value = "websecure" }, { label = "traefik.http.routers.grafana.tls.certresolver", value = "linode" }, diff --git a/terraform/grafana/main.tf b/terraform/grafana/main.tf index d27c60e..fa225ab 100644 --- a/terraform/grafana/main.tf +++ b/terraform/grafana/main.tf @@ -37,3 +37,11 @@ provider "postgresql" { password = data.sops_file_entry.knot_pdb_terraform_password.data sslmode = "require" } + +data "docker_network" "traefik" { + name = "traefik" +} + +data "docker_network" "public" { + name = "public" +} -- cgit v1.2.3