Skip to content

Commit 8dfe283

Browse files
Merge pull request #125 from pluralsh/file-splits
Split gcp vs other provider setups
2 parents 577c918 + cf733e1 commit 8dfe283

6 files changed

Lines changed: 168 additions & 150 deletions

File tree

templates/setup/config-secrets.tf

Lines changed: 0 additions & 150 deletions
This file was deleted.

templates/setup/config_secrets.tf

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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+
metadata {
11+
name = "infra"
12+
}
13+
14+
depends_on = [module.mgmt.cluster, module.mgmt.ready]
15+
}
16+
17+
resource "kubernetes_secret" "console_config" {
18+
metadata {
19+
name = "console-config"
20+
namespace = kubernetes_namespace.infra.metadata[0].name
21+
}
22+
23+
type = "Opaque"
24+
25+
data = {
26+
consoleDns = tostring(try(local.console_values.ingress.console_dns, ""))
27+
kasDns = tostring(try(local.console_values.ingress.kas_dns, ""))
28+
29+
clusterIssuer = "plural"
30+
31+
provider = tostring(try(local.console_values.provider, ""))
32+
33+
jwt = tostring(try(local.console_values.secrets.jwt, ""))
34+
erlang = tostring(try(local.console_values.secrets.erlang, ""))
35+
aesKey = tostring(try(local.console_values.secrets.aes_key, ""))
36+
key = tostring(try(local.console_values.secrets.key, ""))
37+
identity = tostring(try(local.console_values.secrets.identity, ""))
38+
pluralClientId = tostring(try(local.console_values.secrets.plural_client_id, ""))
39+
pluralClientSecret = tostring(try(local.console_values.secrets.plural_client_secret, ""))
40+
adminName = tostring(try(local.console_values.secrets.admin_name, ""))
41+
adminEmail = tostring(try(local.console_values.secrets.admin_email, ""))
42+
adminPassword = tostring(try(local.console_values.secrets.admin_password, ""))
43+
clusterName = tostring(try(local.console_values.secrets.cluster_name, ""))
44+
45+
pluralToken = tostring(try(local.console_values.extraSecretEnv.PLURAL_TOKEN, ""))
46+
kasApi = tostring(try(local.console_values.extraSecretEnv.KAS_API_SECRET, ""))
47+
kasPrivateApi = tostring(try(local.console_values.extraSecretEnv.KAS_PRIVATE_API_SECRET, ""))
48+
kasRedis = tostring(try(local.console_values.extraSecretEnv.KAS_REDIS_SECRET, ""))
49+
postgresUrl = tostring(try(local.console_values.extraSecretEnv.POSTGRES_URL, ""))
50+
}
51+
52+
depends_on = [kubernetes_namespace.infra, module.mgmt.cluster, module.mgmt.ready]
53+
}
54+
55+
resource "kubernetes_secret" "runtime_config" {
56+
57+
metadata {
58+
name = "runtime-config"
59+
namespace = kubernetes_namespace.infra.metadata[0].name
60+
}
61+
62+
type = "Opaque"
63+
64+
data = {
65+
ownerEmail = tostring(try(local.runtime_values.ownerEmail, ""))
66+
pluralToken = tostring(try(local.runtime_values.pluralToken, ""))
67+
acmeEABKid = tostring(try(local.runtime_values.acmeEAB.kid, ""))
68+
acmeEABSecret = tostring(try(local.runtime_values.acmeEAB.secret, ""))
69+
}
70+
71+
depends_on = [kubernetes_namespace.infra, module.mgmt.cluster, module.mgmt.ready]
72+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
this can be used for provisioning any base infrastructure for your environment, a couple of common usecases:
2+
* setting up multi-cluster networks
3+
* setting up dns zones, subdomains, etc
4+
* configuring Cloud IAM throughout your environment
5+
6+
It is deliberately left blank as this is a blank-slate BYOK setup
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Feel free to define variables here
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
terraform {
2+
required_version = ">= 1.0"
3+
4+
required_providers {
5+
plural = {
6+
source = "pluralsh/plural"
7+
version = ">= 0.2.9"
8+
}
9+
}
10+
}
11+
12+
provider "plural" {}

0 commit comments

Comments
 (0)