From ac1a77cf851c2dbce70b4454b6cf9c5ee9523a2e Mon Sep 17 00:00:00 2001 From: Layla Manley Date: Mon, 3 Jun 2024 19:22:23 +0200 Subject: [PATCH] Add mealie to Terraform --- services/mealie/Taskfile.dist.yml | 8 ++++++++ services/mealie/_common/main.tf | 28 ++++++++++++++++++++++++++++ services/mealie/_common/vars.tf | 10 ++++++++++ services/mealie/_common/versions.tf | 7 +++++++ services/mealie/main/main.tf | 6 ++++++ services/mealie/main/versions.tf | 7 +++++++ 6 files changed, 66 insertions(+) create mode 100644 services/mealie/Taskfile.dist.yml create mode 100644 services/mealie/_common/main.tf create mode 100644 services/mealie/_common/vars.tf create mode 100644 services/mealie/_common/versions.tf create mode 100644 services/mealie/main/main.tf create mode 100644 services/mealie/main/versions.tf diff --git a/services/mealie/Taskfile.dist.yml b/services/mealie/Taskfile.dist.yml new file mode 100644 index 0000000..85a3183 --- /dev/null +++ b/services/mealie/Taskfile.dist.yml @@ -0,0 +1,8 @@ +version: "3" + +includes: + tf: + vars: + SERVICE: "mealie" + ENVIRONMENT: "main" + taskfile: ../../taskfiles/Taskfile_service.dist.yml diff --git a/services/mealie/_common/main.tf b/services/mealie/_common/main.tf new file mode 100644 index 0000000..9826ddd --- /dev/null +++ b/services/mealie/_common/main.tf @@ -0,0 +1,28 @@ +resource "docker_container" "mealie" { + image = "ghcr.io/mealie-recipes/mealie:${var.mealie_version}" + name = var.container_name + + restart = "always" + + env = [ + "TZ=Europe/Stockholm", + "ALLOW_SIGNUP=false", + "BASE_URL=https://mealie.layla.gg", + "PUID=1000", + "PGID=1000", + ] + + ports { + internal = 9000 + external = 9925 + } + + + mounts { + target = "/app/data" + source = "/volume1/cloud/${var.container_name}/data" + read_only = false + type = "bind" + } + +} diff --git a/services/mealie/_common/vars.tf b/services/mealie/_common/vars.tf new file mode 100644 index 0000000..1755385 --- /dev/null +++ b/services/mealie/_common/vars.tf @@ -0,0 +1,10 @@ +variable "mealie_version" { + description = "Container tag" + type = string + default = "1" +} + +variable "container_name" { + description = "Container name" + type = string +} diff --git a/services/mealie/_common/versions.tf b/services/mealie/_common/versions.tf new file mode 100644 index 0000000..b433ffb --- /dev/null +++ b/services/mealie/_common/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_providers { + docker = { + source = "kreuzwerker/docker" + } + } +} diff --git a/services/mealie/main/main.tf b/services/mealie/main/main.tf new file mode 100644 index 0000000..1c0e542 --- /dev/null +++ b/services/mealie/main/main.tf @@ -0,0 +1,6 @@ +module "mealie" { + source = "../_common" + + container_name = "mealie" + mealie_version = "v1.0.0-RC1.1" +} diff --git a/services/mealie/main/versions.tf b/services/mealie/main/versions.tf new file mode 100644 index 0000000..b433ffb --- /dev/null +++ b/services/mealie/main/versions.tf @@ -0,0 +1,7 @@ +terraform { + required_providers { + docker = { + source = "kreuzwerker/docker" + } + } +}