This repository has been archived by the owner on Jul 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
deploy.tf
79 lines (66 loc) · 1.47 KB
/
deploy.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
nomad = {
source = "hashicorp/nomad"
version = "1.4.19"
}
}
}
variable "commit" {
default = "0000000000000000000000000000000000000000"
}
variable "image" {
default = "ghcr.io/andyshinn/wbld:latest"
}
variable "github_token" {
description = "GitHub token for GHCR auth"
sensitive = true
}
variable "discord_token" {
description = "Discord auth token"
sensitive = true
}
variable "sentry_dsn" {
description = "Sentry DSN URL"
sensitive = true
}
variable "ping_url" {
description = "Health check ping URL"
sensitive = true
}
provider "nomad" {
address = "http://127.0.0.1:4646"
}
provider "docker" {
host = "unix:///var/run/docker.sock"
registry_auth {
address = "ghcr.io"
username = "andyshinn"
password = var.github_token
}
}
resource "docker_volume" "wbld_buildcache" {
name = "wbld_buildcache"
driver = "local"
}
resource "docker_volume" "wbld_platformio" {
name = "wbld_platformio"
driver = "local"
}
resource "nomad_job" "wbld" {
depends_on = [docker_volume.wbld_buildcache, docker_volume.wbld_platformio]
jobspec = templatefile(
"job.hcl.tpl",
{ github_token = var.github_token,
discord_token = var.discord_token,
sentry_dsn = var.sentry_dsn,
image = var.image,
ping_url = var.ping_url,
commit = var.commit
}
)
}