From 177895ce74e47bc9327020a73b39b080a872315a Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 5 Feb 2025 18:04:47 +0100 Subject: z2m: Creating tf module --- terraform/lhn2pi-zigbee2mqtt/main.tf | 7 +++++ terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf | 44 ----------------------------- 2 files changed, 7 insertions(+), 44 deletions(-) delete mode 100644 terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf (limited to 'terraform/lhn2pi-zigbee2mqtt') diff --git a/terraform/lhn2pi-zigbee2mqtt/main.tf b/terraform/lhn2pi-zigbee2mqtt/main.tf index 1aefaaa..90527ee 100644 --- a/terraform/lhn2pi-zigbee2mqtt/main.tf +++ b/terraform/lhn2pi-zigbee2mqtt/main.tf @@ -31,3 +31,10 @@ locals { module "ipam" { source = "../ipam6" } + +module "zigbee2mqtt" { + source = "../modules/zigbee2mqtt" + + public_ip = local.public_ip + serial_port = "/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2688076-if00" +} diff --git a/terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf b/terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf deleted file mode 100644 index 1e3e1a9..0000000 --- a/terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf +++ /dev/null @@ -1,44 +0,0 @@ -data "docker_registry_image" "zigbee2mqtt" { - name = local.docker_image -} - -resource "docker_image" "zigbee2mqtt" { - name = data.docker_registry_image.zigbee2mqtt.name - pull_triggers = [data.docker_registry_image.zigbee2mqtt.sha256_digest] -} - -resource "docker_volume" "zigbee2mqtt" { - name = "zigbee2mqtt" -} - -resource "docker_container" "zigbee2mqtt" { - image = docker_image.zigbee2mqtt.image_id - name = "zigbee2mqtt" - hostname = "zigbee2mqtt" - # privileged = true - must_run = true - - network_mode = "host" - - ports { - internal = 8080 - external = 8080 - protocol = "tcp" - ip = local.public_ip - } - - volumes { - volume_name = docker_volume.zigbee2mqtt.name - read_only = false - container_path = "/app/data" - } - - env = [ - "TZ=Europe/Oslo", - ] - - devices { - host_path = "/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2688076-if00" - container_path = "/dev/ttyACM0" - } -} -- cgit v1.2.3