Skip to content

Commit

Permalink
Set artifact_url as variable
Browse files Browse the repository at this point in the history
  • Loading branch information
taiidani committed Aug 19, 2023
1 parent c9f6c03 commit 53a77cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/deploy/guess-my-word.nomad
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
variable "artifact_url" {
type = string
}

job "guess-my-word" {
datacenters = ["dc1"]
type = "service"
Expand All @@ -14,7 +18,7 @@ job "guess-my-word" {
driver = "docker"

config {
image = "${image_name}"
image = var.artifact_url
args = ["/app"]
ports = ["web"]
}
Expand All @@ -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
}

Expand Down
9 changes: 5 additions & 4 deletions .github/deploy/main.tf
Original file line number Diff line number Diff line change
@@ -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
}
}
}

Expand Down

0 comments on commit 53a77cb

Please sign in to comment.