-
Notifications
You must be signed in to change notification settings - Fork 1
/
locals.tf
57 lines (51 loc) · 2.07 KB
/
locals.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
locals {
kubeconfig_filename = abspath(pathexpand(var.kubeconfig_filename))
master_nodes = [for i, node in var.master_nodes : {
node_type : try(node.node_type, "master")
hostname : try(node.hostname, "")
address : try(node.address, "")
disks : try(node.disks, {})
node_labels : merge(var.default_master_node_labels, try(node.node_labels, {}))
node_taints : toset(concat(var.default_master_node_taints, try(node.node_taints, [])))
}]
infra_nodes = [for i, node in var.infra_nodes : {
node_type : try(node.node_type, "infra")
hostname : try(node.hostname, "")
address : try(node.address, "")
disks : try(node.disks, {})
node_labels : merge(var.default_infra_node_labels, try(node.node_labels, {}))
node_taints : toset(concat(var.default_infra_node_taints, try(node.node_taints, [])))
}]
app_nodes = [for i, node in var.app_nodes : {
node_type : try(node.node_type, "worker")
hostname : try(node.hostname, "")
address : try(node.address, "")
disks : try(node.disks, {})
node_labels : merge(var.default_app_node_labels, try(node.node_labels, {}))
node_taints : toset(concat(var.default_app_node_taints, try(node.node_taints, [])))
}]
all_nodes = concat(local.master_nodes, local.infra_nodes, local.app_nodes)
modules_result = {
for name, config in merge(var.modules, local.modules) : name => merge(config, {
output : try(config.enabled, true) ? lookup(local.register_modules, name, try(config.output, tomap({}))) : tomap({})
})
}
manifests_template_vars = merge(
{
cluster : {
region : var.region
}
},
var.manifests_template_vars,
{
cluster_provider : var.cluster_provider
alertmanager_cronitor_id : var.cronitor_id
alertmanager_opsgenie_integration_api_key : var.opsgenie_integration_api_key
secret : random_string.secret.result
suffix : random_string.suffix.result
modules : local.modules_result
},
module.teleport-agent.teleport_agent_config,
{ for k, v in var.manifests_template_vars : k => v if k != "modules" }
)
}