-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironments_outputs.tf
38 lines (35 loc) · 1.59 KB
/
environments_outputs.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
# ---------------------------------------------------------------------------------------------------------------------
# Outputs
# ---------------------------------------------------------------------------------------------------------------------
output "environments" {
description = "Full configuration for each environment."
value = lookup(local.dev, "disable_outputs", false) ? null : local.environments_outputs
}
# ---------------------------------------------------------------------------------------------------------------------
# Computations
# ---------------------------------------------------------------------------------------------------------------------
locals {
environments_outputs_prepare = { for env_id, env in local.environments :
env_id => merge(env, {
clusters = { for cluster_id, cluster in env.clusters :
cluster_id => merge(cluster, try(local.clusters_k8s["${env_id}_${cluster_id}"], null))
}
})
}
environments_outputs = { for env_id, env in local.environments_outputs_prepare :
env_id => merge(env, {
clusters = { for cluster_id, cluster in env.clusters :
cluster_id => { for k, v in cluster :
k => v if k != "_env" && k != "kube_config" && k != "kube_token" && k != "kube_ca_certificate"
}
}
})
}
environments_outputs_sensitive = { for env_id, env in local.environments_outputs_prepare :
env_id => { for cluster_id, cluster in env.clusters :
(cluster_id) => { for k, v in cluster :
k => v if k == "kube_config" || k == "kube_token" || k == "kube_ca_certificate"
}
}
}
}