diff options
Diffstat (limited to 'terraform/modules/zigbee2mqtt/zigbee2mqtt.tf')
-rw-r--r-- | terraform/modules/zigbee2mqtt/zigbee2mqtt.tf | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/terraform/modules/zigbee2mqtt/zigbee2mqtt.tf b/terraform/modules/zigbee2mqtt/zigbee2mqtt.tf new file mode 100644 index 0000000..967727d --- /dev/null +++ b/terraform/modules/zigbee2mqtt/zigbee2mqtt.tf @@ -0,0 +1,45 @@ +data "docker_registry_image" "zigbee2mqtt" { + name = "${var.docker_image}:${var.docker_version}" +} + +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 = var.public_ip + } + + volumes { + volume_name = docker_volume.zigbee2mqtt.name + read_only = false + container_path = "/app/data" + } + + env = [ + "TZ=Europe/Oslo", + ] + + devices { + host_path = var.serial_port + container_path = "/dev/ttyACM0" + permissions = "rwm" + } +} |