aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--terraform/lhn2pi-zigbee2mqtt/.terraform.lock.hcl87
-rw-r--r--terraform/lhn2pi-zigbee2mqtt/README.md15
-rw-r--r--terraform/lhn2pi-zigbee2mqtt/backend.tf16
-rw-r--r--terraform/lhn2pi-zigbee2mqtt/main.tf32
-rw-r--r--terraform/lhn2pi-zigbee2mqtt/terragrunt.hcl3
-rw-r--r--terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf41
6 files changed, 194 insertions, 0 deletions
diff --git a/terraform/lhn2pi-zigbee2mqtt/.terraform.lock.hcl b/terraform/lhn2pi-zigbee2mqtt/.terraform.lock.hcl
new file mode 100644
index 0000000..e61b376
--- /dev/null
+++ b/terraform/lhn2pi-zigbee2mqtt/.terraform.lock.hcl
@@ -0,0 +1,87 @@
+# This file is maintained automatically by "terraform init".
+# Manual edits may be lost in future updates.
+
+provider "registry.terraform.io/cyrilgdn/postgresql" {
+ version = "1.18.0"
+ constraints = "1.18.0"
+ hashes = [
+ "h1:Nf26liFILUZXPh1P2B8T3qtq2Tc7objtm0sBSt0lhh0=",
+ "zh:251b609167ce25e974607c0c7dd3f90cfc45980c9068364f896e26c31416d96c",
+ "zh:317980d14a6a171f118bb522ffd02046e508d98100073f97671aeb2adae30d79",
+ "zh:3622c6414e91f8ccceed94ddf12062a22c14de4fac73c6142b009ae791ca7cd4",
+ "zh:36be2b338c230b0ab0c7b4c55049dba9bd8d705973c2cceaf3e293d41f520db5",
+ "zh:4332e83b91f60c43679ff9660c8ef4ebe251e05926a4d20dc64db1bfbabc8670",
+ "zh:444835840c917aff17f49f9f7b4ae542d5bd9f2ec306b581d1931b00380213bd",
+ "zh:5174bd85ea94ed4a6cef6c02bc27498f47ac21841fcab7487ab19d8513c97e54",
+ "zh:61c6eb6b2bf18cdc0734c101854e25990ba24a16580c6bbc599a0b00f72be397",
+ "zh:b40bbc61a4e522b22ebd57f01a518370a97cd6945e4bdd2955e5f887c88ee3f6",
+ "zh:d7aeb158c884f6590d6033cd44d5e9438f648bcb5ca3bd54573847c287845b00",
+ "zh:da3bee1282f6b48572d15f7a693113931afb306b98e29c09c9a054bdc3d6df44",
+ "zh:ec864a068eeab48899d99405f5606379478df8e48c005844d63a5360c23d5e15",
+ "zh:fda709d1cabde236b79c98c9abb80f2c1591fdea751afadc546073056be6e6ba",
+ "zh:ff08607ab25d1c5b55c3794b67a4ee2c9ac5023962c196ce587df34f0e201ca6",
+ ]
+}
+
+provider "registry.terraform.io/kreuzwerker/docker" {
+ version = "3.0.2"
+ constraints = "3.0.2"
+ hashes = [
+ "h1:cT2ccWOtlfKYBUE60/v2/4Q6Stk1KYTNnhxSck+VPlU=",
+ "zh:15b0a2b2b563d8d40f62f83057d91acb02cd0096f207488d8b4298a59203d64f",
+ "zh:23d919de139f7cd5ebfd2ff1b94e6d9913f0977fcfc2ca02e1573be53e269f95",
+ "zh:38081b3fe317c7e9555b2aaad325ad3fa516a886d2dfa8605ae6a809c1072138",
+ "zh:4a9c5065b178082f79ad8160243369c185214d874ff5048556d48d3edd03c4da",
+ "zh:5438ef6afe057945f28bce43d76c4401254073de01a774760169ac1058830ac2",
+ "zh:60b7fadc287166e5c9873dfe53a7976d98244979e0ab66428ea0dea1ebf33e06",
+ "zh:61c5ec1cb94e4c4a4fb1e4a24576d5f39a955f09afb17dab982de62b70a9bdd1",
+ "zh:a38fe9016ace5f911ab00c88e64b156ebbbbfb72a51a44da3c13d442cd214710",
+ "zh:c2c4d2b1fd9ebb291c57f524b3bf9d0994ff3e815c0cd9c9bcb87166dc687005",
+ "zh:d567bb8ce483ab2cf0602e07eae57027a1a53994aba470fa76095912a505533d",
+ "zh:e83bf05ab6a19dd8c43547ce9a8a511f8c331a124d11ac64687c764ab9d5a792",
+ "zh:e90c934b5cd65516fbcc454c89a150bfa726e7cf1fe749790c7480bbeb19d387",
+ "zh:f05f167d2eaf913045d8e7b88c13757e3cf595dd5cd333057fdafc7c4b7fed62",
+ "zh:fcc9c1cea5ce85e8bcb593862e699a881bd36dffd29e2e367f82d15368659c3d",
+ ]
+}
+
+provider "registry.terraform.io/linode/linode" {
+ version = "1.30.0"
+ constraints = "1.30.0"
+ hashes = [
+ "h1:rd4yQ7u3awn2kTqdKf5D67TTeo6rybYpDry/WwvolRA=",
+ "zh:197c61c5eb2252f65c18d2aa65cdc0511617b13e2388118f3fe063d7969dd7ad",
+ "zh:1a66470682acb13dc57308d5b1eaa19ff60c2404a3b15714e3072d02d569b1a5",
+ "zh:368cdcf17073a39687da830c02cf3ce50e0d8f03b7ec808b49561628be798abc",
+ "zh:42f2510a70afbb7fc8928df119d1e14ce1b61d2aded13b88072858ee5861feb2",
+ "zh:57734dd1e8255abd52a33ff79c20ef4efc3831850b22dd1a628e6301c3cf95c6",
+ "zh:61d614a7a4607bfc4ab6bfd0501007501957b973dbd028e0e513a3d4df07f12e",
+ "zh:79243f22fc0a9adfc1123abdd17c515f0ce4d8147302889033b6c44f6a48337e",
+ "zh:9f7cd46185bbe2c001dab1d0bd6c17a9740e7279d3fffe93755f2c964e267213",
+ "zh:9fdc9f8f47bde4140bc14cf082bbc2ceb63a3bebf0683df2fefd83c9e248274c",
+ "zh:aa1fd80a7ea245f8b852e40c68ccde2d8b6446e2138ebdec7425c67e82099881",
+ "zh:bb31f1ba5b0e001cf343d3a4cfafa70e6f3e30fd8a200d2cd7e077663efe0456",
+ "zh:da87881fa030287df2009028c49581e1fd0ff89baef0d8543b27ca506eff2971",
+ "zh:ed6afd7b1bc7237a9dff5c721ca3a5c7c505803cd5ea0b4ad0dfdf07ed6f9b0d",
+ "zh:ee653d5d08cb331ce2d8dc1010e68d363470ae87be62c0515e5d2418727cd02b",
+ ]
+}
+
+provider "registry.terraform.io/lokkersp/sops" {
+ version = "0.6.10"
+ constraints = "0.6.10"
+ hashes = [
+ "h1:atU8NIBxpNTWY+qBubvEOfjOn4K1aCDoq1iUFocgIHQ=",
+ "zh:0f053a26392a581b1f1ce6316cb7ed8ec4cc75e7f5f1cf7cfd45050b6b3c87ea",
+ "zh:207bb96c4471fce9aeb1b3c217d772692c3d865d294cf4d2501dad41de36a15e",
+ "zh:28506e8f1f3b9eaa95d99043440328044ee6340143535e5751538328a529d001",
+ "zh:3cae3bcea9e35fdc5b3f2af1b4580cd625c996448ad0c676c772260e46b25289",
+ "zh:3e44daaf82986c2b0028aeb17b867f3c68ed5dd8ac8625ba0406cf2a5fd3d92e",
+ "zh:457fb8ca2e677af24f9a4bdd8b613b1d7b604ad7133541657e5757c19268da71",
+ "zh:473d727c228f021a3df8cc8dcc6231ad7f90ed63f9e47c36b597d591e76228da",
+ "zh:48c4c1df39fd76ec8bd5fe9ac70cdc0927ac8be95582dbe46458b3442ce0fcd9",
+ "zh:728b19cb5c07e5e9d8b78fd94cc57d4c13582ecd24b7eb7c4cc2bf73b12fe4d1",
+ "zh:c51ed9af591779bb0910b82addeebb10f53428b994f8db653dd1dedcec60916c",
+ "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
+ ]
+}
diff --git a/terraform/lhn2pi-zigbee2mqtt/README.md b/terraform/lhn2pi-zigbee2mqtt/README.md
new file mode 100644
index 0000000..2e6209c
--- /dev/null
+++ b/terraform/lhn2pi-zigbee2mqtt/README.md
@@ -0,0 +1,15 @@
+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/backend.tf b/terraform/lhn2pi-zigbee2mqtt/backend.tf
new file mode 100644
index 0000000..7251725
--- /dev/null
+++ b/terraform/lhn2pi-zigbee2mqtt/backend.tf
@@ -0,0 +1,16 @@
+# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa
+terraform {
+ required_version = "~> 1.9.5"
+
+ backend "s3" {
+ bucket = "terraform-a6726272-73ff-11ed-8bdd-c79eb8376e05"
+ key = "lhn2pi-zigbee2mqtt/terraform.tfstate"
+ skip_region_validation = true
+ skip_credentials_validation = true
+ skip_metadata_api_check = true
+ skip_requesting_account_id = true
+ skip_s3_checksum = true
+ region = "eu-central-1"
+ endpoints = { s3 : "https://eu-central-1.linodeobjects.com" }
+ }
+}
diff --git a/terraform/lhn2pi-zigbee2mqtt/main.tf b/terraform/lhn2pi-zigbee2mqtt/main.tf
new file mode 100644
index 0000000..009ac7d
--- /dev/null
+++ b/terraform/lhn2pi-zigbee2mqtt/main.tf
@@ -0,0 +1,32 @@
+terraform {
+ required_providers {
+ docker = {
+ 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"
+}
+
+locals {
+ docker_image = "koenkk/zigbee2mqtt:1.42.0"
+}
+
+module "ipam" {
+ source = "../ipam6"
+}
diff --git a/terraform/lhn2pi-zigbee2mqtt/terragrunt.hcl b/terraform/lhn2pi-zigbee2mqtt/terragrunt.hcl
new file mode 100644
index 0000000..e147285
--- /dev/null
+++ b/terraform/lhn2pi-zigbee2mqtt/terragrunt.hcl
@@ -0,0 +1,3 @@
+include "root" {
+ path = find_in_parent_folders()
+}
diff --git a/terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf b/terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf
new file mode 100644
index 0000000..a77fe95
--- /dev/null
+++ b/terraform/lhn2pi-zigbee2mqtt/zigbee2mqtt.tf
@@ -0,0 +1,41 @@
+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
+
+ ports {
+ internal = 8080
+ external = 8080
+ protocol = "tcp"
+ }
+
+ 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"
+ }
+}