-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitops_defaults.tf
49 lines (45 loc) · 1.97 KB
/
gitops_defaults.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
# ---------------------------------------------------------------------------------------------------------------------
# Main variables
# ---------------------------------------------------------------------------------------------------------------------
locals {
gitops_configuration = { for provider in keys(local.gitops_configuration_simple) :
provider => merge(
local.gitops_configuration_simple[provider],
local.gitops_configuration_complex[provider]
)
}
}
# ---------------------------------------------------------------------------------------------------------------------
# Defaults
# ---------------------------------------------------------------------------------------------------------------------
locals {
gitops_configuration_defaults_base = {
base_dir = "_ostack"
tenant_isolation = true
init_cluster = {
module_source = "Olivr/init-cluster/flux"
module_version = ""
}
}
gitops_configuration_defaults = {
flux = local.gitops_configuration_defaults_base
}
}
# ---------------------------------------------------------------------------------------------------------------------
# Computations
# ---------------------------------------------------------------------------------------------------------------------
locals {
# Defaults for simple types
gitops_configuration_simple = { for provider, default_settings in local.gitops_configuration_defaults :
provider => { for setting, default_value in default_settings :
setting => try(var.gitops_configuration_base[provider][setting], null) != null ? var.gitops_configuration_base[provider][setting] : default_value
if !contains(["init_cluster"], setting)
}
}
# Defaults for complex types
gitops_configuration_complex = { for provider, default_settings in local.gitops_configuration_defaults :
provider => {
init_cluster = merge(default_settings.init_cluster, try(var.gitops_configuration_base[provider].init_cluster, null))
}
}
}