diff options
Diffstat (limited to 'terraform/lhn2pi-zigbee2mqtt')
-rw-r--r-- | terraform/lhn2pi-zigbee2mqtt/README.md | 15 | ||||
-rw-r--r-- | terraform/lhn2pi-zigbee2mqtt/main.tf | 24 | ||||
-rw-r--r-- | terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf | 44 |
3 files changed, 10 insertions, 73 deletions
diff --git a/terraform/lhn2pi-zigbee2mqtt/README.md b/terraform/lhn2pi-zigbee2mqtt/README.md deleted file mode 100644 index 2e6209c..0000000 --- a/terraform/lhn2pi-zigbee2mqtt/README.md +++ /dev/null @@ -1,15 +0,0 @@ -This is not a docker container as the rest, but using podman as lhn2pi runs - -https://www.zigbee2mqtt.io/guide/installation/02_docker.html#rootless-container - -podman run \ - --name=zigbee2mqtt \ - --restart=unless-stopped \ - -p 8080:8080 \ - -v $(pwd)/data:/app/data \ - -v /run/udev:/run/udev:ro \ - --device=/dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00:/dev/ttyACM0 \ - --group-add keep-groups \ - -e TZ=Europe/Amsterdam \ - koenkk/zigbee2mqtt - diff --git a/terraform/lhn2pi-zigbee2mqtt/main.tf b/terraform/lhn2pi-zigbee2mqtt/main.tf index 4182db8..2857b99 100644 --- a/terraform/lhn2pi-zigbee2mqtt/main.tf +++ b/terraform/lhn2pi-zigbee2mqtt/main.tf @@ -4,30 +4,26 @@ terraform { source = "kreuzwerker/docker" version = "3.0.2" } - linode = { - source = "linode/linode" - version = "1.30.0" - } - postgresql = { - source = "cyrilgdn/postgresql" - version = "1.18.0" - } - sops = { - source = "lokkersp/sops" - version = "0.6.10" - } } } provider "docker" { - host = "ssh://lhn2pi.dn42.trygvis.io" + host = "ssh://${local.host}" } locals { + host = "lhn2pi.dn42.trygvis.io" docker_image = "koenkk/zigbee2mqtt:1.42.0" - public_ip = module.ipam.hosts.lhn2-z2m.address + public_ip = module.ipam.hosts.lhn2pi.address } 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" - } -} |