-
Notifications
You must be signed in to change notification settings - Fork 1
/
helm_release-coder.tf
78 lines (62 loc) · 1.63 KB
/
helm_release-coder.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
resource "kubernetes_namespace" "coder" {
metadata {
name = "coder"
}
}
resource "kubernetes_secret" "coder_db" {
metadata {
name = "coder-db-url"
namespace = "coder"
}
data = {
# TODO: This uses the default username / password for the db, not the one we created. We should fix this
url = "postgres://${postgresql_role.coder.name}:${random_password.password.result}@${civo_database.coder_database.endpoint}:${civo_database.coder_database.port}/${postgresql_database.coder-database.name}?sslmode=require"
}
depends_on = [kubernetes_namespace.coder]
}
resource "helm_release" "coder" {
name = "coder"
repository = "https://helm.coder.com/v2"
chart = "coder"
namespace = "coder"
values = [
file("${path.module}/coder-values.yaml")
]
set {
name = "coder.ingress.host"
value = "coder.${var.domain}"
}
set {
name = "coder.ingress.annotations.external-dns\\.alpha\\.kubernetes\\.io/hostname"
value = "coder.${var.domain}"
}
set {
name = "coder.ingress.annotations.cert-manager\\.io/cluster-issuer"
value = "letsencrypt-prod"
}
set {
name = "coder.ingress.tls.enable"
value = "true"
}
set {
name = "coder.ingress.tls.secretName"
value = "coder-tls"
}
set {
name = "coder.env[1].name"
value = "CODER_ACCESS_URL"
}
set {
name = "coder.env[1].value"
value = "https://coder.${var.domain}"
}
depends_on = [
kubernetes_namespace.coder,
kubernetes_secret.coder_db,
helm_release.cert-manager,
]
}
# output of the domain to access coder on
output "domain" {
value = "https://coder.${var.domain}"
}