This repository has been archived on 2024-11-12. You can view files and clone it, but cannot push or open issues or pull requests.
iac/ubiquity.tf
Matthew Baggett 5f01e175a8
Some checks failed
Trunk Check / Trunk Check Runner (push) Failing after 2s
Add duplicate of unifi system for restoring a backup
2024-07-14 13:14:07 +02:00

143 lines
No EOL
3.2 KiB
HCL

data "docker_registry_image" "unifi_controller" {
name = "jacobalberty/unifi"
}
resource "docker_service" "unifi_controller" {
name = "unifi_controller"
provider = docker.unifi
task_spec {
container_spec {
image = "${data.docker_registry_image.unifi_controller.name}@${data.docker_registry_image.unifi_controller.sha256_digest}"
env = {
TZ = "Europe/Amsterdam"
}
mounts {
target = "/unifi"
source = "/home/techinc/unifi"
type = "bind"
}
}
restart_policy {
condition = "any"
delay = "0s"
window = "0s"
}
}
endpoint_spec {
ports {
target_port = 8443
published_port = 443
publish_mode = "ingress"
}
ports {
target_port = 8443
published_port = 8443
publish_mode = "ingress"
}
ports {
target_port = 3478
published_port = 3478
publish_mode = "ingress"
protocol = "udp"
}
ports {
target_port = 10001
published_port = 10001
publish_mode = "ingress"
protocol = "udp"
}
ports {
target_port = 8080
published_port = 8080
publish_mode = "ingress"
}
}
}
resource "docker_service" "unifi_controller_restored_from_backup" {
name = "unifi_controller_restored_from_backup"
provider = docker.unifi
task_spec {
container_spec {
image = "${data.docker_registry_image.unifi_controller.name}@${data.docker_registry_image.unifi_controller.sha256_digest}"
env = {
TZ = "Europe/Amsterdam"
}
mounts {
target = "/unifi"
source = "/home/techinc/unifi_restored_from_backup"
type = "bind"
}
}
restart_policy {
condition = "any"
delay = "0s"
window = "0s"
}
}
endpoint_spec {
ports {
target_port = 443
published_port = 444
publish_mode = "ingress"
}
}
}
data "docker_registry_image" "http2https" {
name = "articulate/http-to-https"
}
resource "docker_service" "unifi_http2https" {
name = "http2https"
provider = docker.unifi
task_spec {
container_spec {
image = "${data.docker_registry_image.http2https.name}@${data.docker_registry_image.http2https.sha256_digest}"
}
restart_policy {
condition = "any"
delay = "0s"
window = "0s"
}
}
endpoint_spec {
ports {
target_port = 80
published_port = 80
publish_mode = "ingress"
}
}
}
data "docker_registry_image" "iperf" {
name = "loganmarchione/docker-iperf3:latest"
provider = docker.unifi
}
resource "docker_service" "unifi_iperf" {
name = "iperf"
provider = docker.unifi
task_spec {
container_spec {
image = "${data.docker_registry_image.iperf.name}@${data.docker_registry_image.iperf.sha256_digest}"
}
restart_policy {
condition = "any"
delay = "0s"
window = "0s"
}
}
endpoint_spec {
ports {
target_port = 5201
published_port = 5201
publish_mode = "ingress"
protocol = "tcp"
}
ports {
target_port = 5201
published_port = 5201
publish_mode = "ingress"
protocol = "udp"
}
}
}