This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
kubernetes_vault_service.tf
90 lines (72 loc) · 1.69 KB
/
kubernetes_vault_service.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
resource kubernetes_service vault_lb {
count = "${var.vault_service_type == "LoadBalancer" ? 1 : 0}"
metadata {
name = "vault"
namespace = "${var.kubernetes_namespace}"
annotations {
"cloud.google.com/load-balancer-type" = "${var.vault_load_balancer_is_internal ? "Internal" : "External"}"
}
labels {
app = "vault"
}
}
spec {
type = "LoadBalancer"
load_balancer_ip = "${coalesce(var.vault_load_balancer_ip, join("",google_compute_address.vault.*.address))}"
selector {
app = "vault"
}
port {
name = "${local.vault_service_protocol}-vault"
port = 443
target_port = 8200
protocol = "TCP"
}
}
}
resource kubernetes_service vault {
count = "${var.vault_service_type == "LoadBalancer" ? 0 : 1}"
metadata {
name = "vault"
namespace = "${var.kubernetes_namespace}"
labels {
app = "vault"
}
annotations {
"cloud.google.com/app-protocols" = "{\"${local.vault_service_protocol}-vault\":\"HTTPS\"}"
}
}
spec {
type = "${var.vault_service_type}"
selector {
app = "vault"
}
port {
name = "${local.vault_service_protocol}-vault"
port = 8200
target_port = 8200
protocol = "TCP"
}
}
}
resource kubernetes_service vault_cluster {
metadata {
name = "vault-cluster"
namespace = "${var.kubernetes_namespace}"
labels {
app = "vault-cluster"
}
}
spec {
type = "ClusterIP"
selector {
app = "vault"
}
port {
name = "tcp-cluster"
port = 8201
target_port = 8201
protocol = "TCP"
}
}
}