From 06a9c241b2462e9819fd5ca58a519f4f538a85e4 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 21 Aug 2024 22:47:51 +0200 Subject: unifi --- terraform/unifi-controller/main.tf | 4 +++- terraform/unifi-controller/mongo.tf | 5 ++++- terraform/unifi-controller/unifi.tf | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'terraform/unifi-controller') diff --git a/terraform/unifi-controller/main.tf b/terraform/unifi-controller/main.tf index f5f7b0a..55c133c 100644 --- a/terraform/unifi-controller/main.tf +++ b/terraform/unifi-controller/main.tf @@ -28,8 +28,10 @@ provider "docker" { locals { domain_name = "unifi.vpn.trygvis.io" + public_ip = "fdb1:4242:3538:2001::ffff" + docker_image_controller = "lscr.io/linuxserver/unifi-controller:8.0.24-mongoless" - docker_image_mongo = "mongo:7.0" + docker_image_mongo = "mongo:7.0" mongo_database = "unifi" mongo_username = "unifi" diff --git a/terraform/unifi-controller/mongo.tf b/terraform/unifi-controller/mongo.tf index 98b4e36..2b83691 100644 --- a/terraform/unifi-controller/mongo.tf +++ b/terraform/unifi-controller/mongo.tf @@ -24,15 +24,18 @@ resource "docker_container" "unifi-mongo" { name = docker_network.unifi.name } + network_mode = "bridge" + volumes { volume_name = docker_volume.unifi-mongo.name + read_only = false container_path = "/data/db" } } output "mongo_init_js" { sensitive = true - value = <<-EOF + value = <<-EOF db.getSiblingDB("${local.mongo_database}"). createUser({ user: "${local.mongo_database}", diff --git a/terraform/unifi-controller/unifi.tf b/terraform/unifi-controller/unifi.tf index 8e6c7d7..4b0f1c6 100644 --- a/terraform/unifi-controller/unifi.tf +++ b/terraform/unifi-controller/unifi.tf @@ -52,12 +52,13 @@ resource "docker_container" "unifi-controller" { internal = ports.value["port"] external = ports.value["port"] protocol = ports.value["proto"] - ip = "fdf3:aad9:a885:77dd::2" + ip = local.public_ip } } volumes { volume_name = docker_volume.unifi-controller.name + read_only = false container_path = "/config" } -- cgit v1.2.3