diff --git a/lychee.tf b/lychee.tf index 46d6fe6..b97c530 100644 --- a/lychee.tf +++ b/lychee.tf @@ -13,10 +13,9 @@ module "lychee" { }, ] - uploads = [{ - content = "${file("${path.module}/docker/conf/lychee.php.ini")}" - file = "/config/lychee/user.ini" - }] + files = "/config/lychee/user.ini" + + contents = ["${file("${path.module}/docker/conf/lychee.php.ini")}"] web { expose = true diff --git a/media/airsonic.tf b/media/airsonic.tf index 5fadf62..ae49f76 100644 --- a/media/airsonic.tf +++ b/media/airsonic.tf @@ -22,15 +22,14 @@ module "airsonic" { "JAVA_OPTS=-Xmx512m -Dserver.use-forward-headers=true -Dserver.context-path=/", ] - uploads = [ - { - file = "/usr/lib/jvm/java-1.8-openjdk/jre/lib/airsonic.properties" - content = "${data.template_file.airsonic-properties-file.rendered}" - }, - { - file = "/usr/lib/jvm/java-1.8-openjdk/jre/lib/sound.properties" - content = "${file("${path.module}/conf/airsonic.sound.properties")}" - }, + files = [ + "/usr/lib/jvm/java-1.8-openjdk/jre/lib/airsonic.properties", + "/usr/lib/jvm/java-1.8-openjdk/jre/lib/sound.properties", + ] + + contents = [ + "${data.template_file.airsonic-properties-file.rendered}", + "${file("${path.module}/conf/airsonic.sound.properties")}", ] volumes = [ diff --git a/modules/container/main.tf b/modules/container/main.tf index dcb2320..ca92672 100644 --- a/modules/container/main.tf +++ b/modules/container/main.tf @@ -23,17 +23,11 @@ resource "docker_container" "container" { // Only attach the traefik network if // service is exposed to the web - networks = ["${concat(var.networks, split(",", - lookup(var.web, "expose", "false") == "false" ? - "" : - "${data.docker_network.traefik.id}" - ))}"] + networks = ["${concat(var.networks,split(",",lookup(var.web, "expose", "false") == "false" ? "" :"${data.docker_network.traefik.id}"))}"] memory = "${local.resource["memory"]}" - volumes = "${var.volumes}" - - upload = "${var.uploads}" + volumes = ["${var.volumes}"] # Look at this monstrosity # And then https://github.com/hashicorp/terraform/issues/12453#issuecomment-365569618 diff --git a/modules/container/vars.tf b/modules/container/vars.tf index d9e5857..0540ab0 100644 --- a/modules/container/vars.tf +++ b/modules/container/vars.tf @@ -88,8 +88,3 @@ variable "volumes" { type = "list" default = [] } - -variable "uploads" { - description = "uploads" - default = [] -} diff --git a/modules/image/main.tf b/modules/image/main.tf new file mode 100644 index 0000000..68eb353 --- /dev/null +++ b/modules/image/main.tf @@ -0,0 +1,16 @@ +variable "image" { + description = "image to use" +} + +data "docker_registry_image" "image" { + name = "${var.image}" +} + +resource "docker_image" "image" { + name = "${data.docker_registry_image.image.name}" + pull_triggers = ["${data.docker_registry_image.image.sha256_digest}"] +} + +output "image" { + value = "${docker_image.image.latest}" +} diff --git a/radicale/main.tf b/radicale/main.tf index 65f5466..cd54c1b 100644 --- a/radicale/main.tf +++ b/radicale/main.tf @@ -1,7 +1,12 @@ +module "image" { + source = "../modules/image" + image = "tomsquest/docker-radicale:latest" +} + module "container" { name = "radicale" source = "../modules/container" - image = "tomsquest/docker-radicale:latest" + image = "${module.image.image}" web { expose = true @@ -20,18 +25,18 @@ module "container" { }, ] - uploads = [ - { - content = "${file("${path.module}/config")}" - file = "/config/config" - }, - { - content = "${file("${path.module}/logging.conf")}" - file = "/config/logging" - }, - { - content = "${file("${path.module}/users")}" - file = "/config/users" - }, - ] + # uploads = [ + # { + # content = "${file("${path.module}/config")}" + # file = "/config/config" + # }, + # { + # content = "${file("${path.module}/logging.conf")}" + # file = "/config/logging" + # }, + # { + # content = "${file("${path.module}/users")}" + # file = "/config/users" + # }, + # ] } diff --git a/rss-bridge.tf b/rss-bridge.tf index b70bbad..5563383 100644 --- a/rss-bridge.tf +++ b/rss-bridge.tf @@ -9,9 +9,10 @@ module "rss-bridge" { } networks = "${list(module.docker.traefik-network-id)}" + files = ["/app/public/whitelist.txt"] - uploads = [{ - content = <