From 53a77cbb5afdacd476cec09027a4cd0a86283604 Mon Sep 17 00:00:00 2001 From: Ryan Nixon Date: Sat, 19 Aug 2023 00:46:12 -0700 Subject: [PATCH] Set artifact_url as variable --- .github/deploy/guess-my-word.nomad | 8 ++++++-- .github/deploy/main.tf | 9 +++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/deploy/guess-my-word.nomad b/.github/deploy/guess-my-word.nomad index 32089dc..f82c86d 100644 --- a/.github/deploy/guess-my-word.nomad +++ b/.github/deploy/guess-my-word.nomad @@ -1,3 +1,7 @@ +variable "artifact_url" { + type = string +} + job "guess-my-word" { datacenters = ["dc1"] type = "service" @@ -14,7 +18,7 @@ job "guess-my-word" { driver = "docker" config { - image = "${image_name}" + image = var.artifact_url args = ["/app"] ports = ["web"] } @@ -33,7 +37,7 @@ job "guess-my-word" { REDIS_PASSWORD="{{with secret "credentials/digitalocean/redis"}}{{ .Data.data.password }}{{end}}" REDIS_DB=1 EOF - destination = "$${NOMAD_SECRETS_DIR}/secrets.env" + destination = "${NOMAD_SECRETS_DIR}/secrets.env" env = true } diff --git a/.github/deploy/main.tf b/.github/deploy/main.tf index 00c0881..0bc05d8 100644 --- a/.github/deploy/main.tf +++ b/.github/deploy/main.tf @@ -1,11 +1,12 @@ resource "nomad_job" "app" { - jobspec = templatefile("${path.module}/guess-my-word.nomad", { - image_name = var.artifact_url - }) - detach = false + jobspec = file("${path.module}/guess-my-word.nomad") + detach = false hcl2 { enabled = true + vars = { + artifact_url = var.artifact_url + } } }