Add uptime-kuma to Terraform

This commit is contained in:
Layla 2024-06-03 19:07:46 +02:00
parent 9580b0069c
commit 96a376a917
6 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,8 @@
version: "3"
includes:
tf:
vars:
SERVICE: "uptime-kuma"
ENVIRONMENT: "main"
taskfile: ../../taskfiles/Taskfile_service.dist.yml

View File

@ -0,0 +1,29 @@
resource "docker_container" "uptime_kuma" {
image = "louislam/uptime-kuma:${var.uptime_kuma_version}"
name = var.container_name
restart = "always"
env = []
ports {
internal = 3001
external = 3005
}
# Allows uptime-kuma to access the Docker socket
mounts {
target = "/var/run/docker.sock"
source = "/var/run/docker.sock"
read_only = false
type = "bind"
}
mounts {
target = "/app/data"
source = "/volume1/cloud/${var.container_name}/data"
read_only = false
type = "bind"
}
}

View File

@ -0,0 +1,10 @@
variable "uptime_kuma_version" {
description = "Container tag"
type = string
default = "1"
}
variable "container_name" {
description = "Container name"
type = string
}

View File

@ -0,0 +1,7 @@
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
}
}
}

View File

@ -0,0 +1,6 @@
module "uptime-kuma" {
source = "../_common"
container_name = "uptime-kuma"
uptime_kuma_version = "1"
}

View File

@ -0,0 +1,7 @@
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
}
}
}