-
Notifications
You must be signed in to change notification settings - Fork 4
/
do-k8s-cert-manager.tf
103 lines (92 loc) · 2.18 KB
/
do-k8s-cert-manager.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
locals {
do-cert-manager = {
email = "[email protected]"
ingress_annotations = {
"cert-manager.io/cluster-issuer" = "letsencrypt-production"
}
}
}
# https://cert-manager.io/docs/installation/helm/
resource "helm_release" "do-cert-manager" {
provider = helm.do
name = "cert-manager"
repository = "https://charts.jetstack.io"
chart = "cert-manager"
version = "1.6.1"
values = [yamlencode({
installCRDs = false # CRDs are installed by module.do-cert-manager-crds
})]
depends_on = [
module.do-cert-manager-crds
]
}
# ./cert-manager.crds was generated by
# earthly +cert-manager.crds
module "do-cert-manager-crds" {
source = "./cert-manager.crds"
providers = {
kubernetes = kubernetes.do
}
}
resource "kubernetes_manifest" "do-letsencrypt-issuer-staging" {
provider = kubernetes.do
manifest = {
"apiVersion" = "cert-manager.io/v1"
"kind" = "ClusterIssuer"
"metadata" = {
"name" = "letsencrypt-staging"
}
"spec" = {
"acme" = {
"email" = local.do-cert-manager.email
"privateKeySecretRef" = {
"name" = "letsencrypt-staging"
}
"server" = "https://acme-staging-v02.api.letsencrypt.org/directory"
"solvers" = [
{
"http01" = {
"ingress" = {
"class" = "nginx"
}
}
},
]
}
}
}
depends_on = [
helm_release.do-cert-manager
]
}
resource "kubernetes_manifest" "do-letsencrypt-issuer-production" {
provider = kubernetes.do
manifest = {
"apiVersion" = "cert-manager.io/v1"
"kind" = "ClusterIssuer"
"metadata" = {
"name" = "letsencrypt-production"
}
"spec" = {
"acme" = {
"email" = local.do-cert-manager.email
"privateKeySecretRef" = {
"name" = "letsencrypt-production"
}
"server" = "https://acme-v02.api.letsencrypt.org/directory"
"solvers" = [
{
"http01" = {
"ingress" = {
"class" = "nginx"
}
}
},
]
}
}
}
depends_on = [
helm_release.do-cert-manager
]
}