This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
84 lines (78 loc) · 1.35 KB
/
main.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
80
81
82
83
84
terraform {
required_providers {
koyeb = {
source = "koyeb/koyeb"
version = "~> 0.1.1"
}
}
cloud {
organization = "cherryblossom"
workspaces {
name = "comrade-pingu"
}
}
}
provider "koyeb" {}
locals {
app_name = "comrade-pingu"
port = 3000
}
variable "sha" {
type = string
nullable = false
}
resource "koyeb_app" "comrade-pingu" {
name = local.app_name
}
resource "koyeb_service" "discord-bot" {
app_name = local.app_name
definition {
name = "discord-bot"
docker {
image = "ghcr.io/cherryblossom000/${local.app_name}:sha-${var.sha}"
image_registry_secret = "github-package-read"
args = ["port=${local.port}"]
}
instance_types {
type = "nano"
}
scalings {
min = 1
max = 1
}
regions = ["par"]
ports {
port = local.port
protocol = "http"
}
routes {
path = "/"
port = local.port
}
env {
key = "NODE_ENV"
value = "production"
}
env {
key = "PORT"
value = local.port
}
env {
key = "DISCORD_TOKEN"
secret = "${local.app_name}-discord-token"
}
env {
key = "DB_NAME"
secret = "${local.app_name}-db-name"
}
env {
key = "DB_USER"
secret = "${local.app_name}-db-user"
}
env {
key = "DB_PASSWORD"
secret = "${local.app_name}-db-password"
}
}
depends_on = [koyeb_app.comrade-pingu]
}