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"
published_port = 8443
target_port = 3478
published_port = 3478
protocol = "udp"
target_port = 10001
published_port = 10001
target_port = 8080
published_port = 8080
resource "docker_service" "unifi_controller_restored_from_backup" {
name = "unifi_controller_restored_from_backup"
source = "/home/techinc/unifi_restored_from_backup"
target_port = 443
published_port = 444
data "docker_registry_image" "http2https" {
name = "articulate/http-to-https"
resource "docker_service" "unifi_http2https" {
name = "http2https"
image = "${data.docker_registry_image.http2https.name}@${data.docker_registry_image.http2https.sha256_digest}"
target_port = 80
published_port = 80
data "docker_registry_image" "iperf" {
name = "loganmarchione/docker-iperf3:latest"
resource "docker_service" "unifi_iperf" {
name = "iperf"
image = "${data.docker_registry_image.iperf.name}@${data.docker_registry_image.iperf.sha256_digest}"
target_port = 5201
published_port = 5201
protocol = "tcp"