|
| 1 | +# This file should not be commited to repository. |
| 2 | +# GCP uses the kubernetes.bootstrap provider. |
| 3 | + |
| 4 | +locals { |
| 5 | + console_values = yamldecode(data.local_sensitive_file.console.content) |
| 6 | + runtime_values = yamldecode(data.local_sensitive_file.runtime.content) |
| 7 | +} |
| 8 | + |
| 9 | +resource "kubernetes_namespace" "infra" { |
| 10 | + provider = kubernetes.bootstrap |
| 11 | + |
| 12 | + metadata { |
| 13 | + name = "infra" |
| 14 | + } |
| 15 | + |
| 16 | + depends_on = [module.mgmt.cluster, module.mgmt.ready] |
| 17 | +} |
| 18 | + |
| 19 | +resource "kubernetes_secret" "console_config" { |
| 20 | + provider = kubernetes.bootstrap |
| 21 | + |
| 22 | + metadata { |
| 23 | + name = "console-config" |
| 24 | + namespace = kubernetes_namespace.infra.metadata[0].name |
| 25 | + } |
| 26 | + |
| 27 | + type = "Opaque" |
| 28 | + |
| 29 | + data = { |
| 30 | + consoleDns = tostring(try(local.console_values.ingress.console_dns, "")) |
| 31 | + kasDns = tostring(try(local.console_values.ingress.kas_dns, "")) |
| 32 | + |
| 33 | + clusterIssuer = "plural" |
| 34 | + |
| 35 | + provider = tostring(try(local.console_values.provider, "")) |
| 36 | + |
| 37 | + jwt = tostring(try(local.console_values.secrets.jwt, "")) |
| 38 | + erlang = tostring(try(local.console_values.secrets.erlang, "")) |
| 39 | + aesKey = tostring(try(local.console_values.secrets.aes_key, "")) |
| 40 | + key = tostring(try(local.console_values.secrets.key, "")) |
| 41 | + identity = tostring(try(local.console_values.secrets.identity, "")) |
| 42 | + pluralClientId = tostring(try(local.console_values.secrets.plural_client_id, "")) |
| 43 | + pluralClientSecret = tostring(try(local.console_values.secrets.plural_client_secret, "")) |
| 44 | + adminName = tostring(try(local.console_values.secrets.admin_name, "")) |
| 45 | + adminEmail = tostring(try(local.console_values.secrets.admin_email, "")) |
| 46 | + adminPassword = tostring(try(local.console_values.secrets.admin_password, "")) |
| 47 | + clusterName = tostring(try(local.console_values.secrets.cluster_name, "")) |
| 48 | + |
| 49 | + pluralToken = tostring(try(local.console_values.extraSecretEnv.PLURAL_TOKEN, "")) |
| 50 | + kasApi = tostring(try(local.console_values.extraSecretEnv.KAS_API_SECRET, "")) |
| 51 | + kasPrivateApi = tostring(try(local.console_values.extraSecretEnv.KAS_PRIVATE_API_SECRET, "")) |
| 52 | + kasRedis = tostring(try(local.console_values.extraSecretEnv.KAS_REDIS_SECRET, "")) |
| 53 | + postgresUrl = tostring(try(local.console_values.extraSecretEnv.POSTGRES_URL, "")) |
| 54 | + } |
| 55 | + |
| 56 | + depends_on = [kubernetes_namespace.infra_gcp, module.mgmt.cluster, module.mgmt.ready] |
| 57 | +} |
| 58 | + |
| 59 | +resource "kubernetes_secret" "runtime_config" { |
| 60 | + provider = kubernetes.bootstrap |
| 61 | + |
| 62 | + metadata { |
| 63 | + name = "runtime-config" |
| 64 | + namespace = kubernetes_namespace.infra.metadata[0].name |
| 65 | + } |
| 66 | + |
| 67 | + type = "Opaque" |
| 68 | + |
| 69 | + data = { |
| 70 | + ownerEmail = tostring(try(local.runtime_values.ownerEmail, "")) |
| 71 | + pluralToken = tostring(try(local.runtime_values.pluralToken, "")) |
| 72 | + acmeEABKid = tostring(try(local.runtime_values.acmeEAB.kid, "")) |
| 73 | + acmeEABSecret = tostring(try(local.runtime_values.acmeEAB.secret, "")) |
| 74 | + } |
| 75 | + |
| 76 | + depends_on = [kubernetes_namespace.infra, module.mgmt.cluster, module.mgmt.ready] |
| 77 | +} |
0 commit comments