-
Notifications
You must be signed in to change notification settings - Fork 1
/
kubernetes_secret.tf
46 lines (40 loc) · 1.31 KB
/
kubernetes_secret.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
locals {
gcr_auth = templatefile(
"${path.module}/extra_resources/polyaxon/gcr_auth.tmpl",
{
gcp_project = var.gcp_project,
private_key_id = jsondecode(base64decode(google_service_account_key.polyaxon_gcr_access_key.private_key)).private_key_id,
private_key = jsondecode(base64decode(google_service_account_key.polyaxon_gcr_access_key.private_key)).private_key
}
)
gcr_auth_config_json = templatefile(
"${path.module}/extra_resources/polyaxon/gcr_auth_config.json.tmpl",
{
auth = local.gcr_auth
}
)
}
resource "kubernetes_secret" "polyaxon_gcs_secret" {
count = var.install_polyaxon != "no" ? 1 : 0
metadata {
name = "gcs-secret"
namespace = kubernetes_namespace.polyaxon[0].id
}
data = {
"account.json" = base64decode(google_service_account_key.polyaxon_key.private_key)
}
depends_on = [google_container_cluster.polyaxon_cluster]
}
# Polyaxon & Google GCR
# SEE ALSO: https://docs.polyaxon.com/integrations/gcr/
resource "kubernetes_secret" "polyaxon_gcr_secret" {
count = var.install_polyaxon != "no" ? 1 : 0
metadata {
name = "docker-conf"
namespace = kubernetes_namespace.polyaxon[0].id
}
data = {
"config.json" = base64encode(local.gcr_auth_config_json)
}
depends_on = [google_container_cluster.polyaxon_cluster]
}