|
| 1 | +module "configuration" { |
| 2 | + source = "../../common/configuration" |
| 3 | + |
| 4 | + configuration = var.configuration |
| 5 | + base_key = var.configuration_base_key |
| 6 | +} |
| 7 | + |
| 8 | +locals { |
| 9 | + # current workspace config |
| 10 | + cfg = module.configuration.merged[terraform.workspace] |
| 11 | + |
| 12 | + name_prefix = local.cfg["name_prefix"] |
| 13 | + |
| 14 | + base_domain = local.cfg["base_domain"] |
| 15 | + |
| 16 | + http_port_default = terraform.workspace == "apps" ? 80 : 8080 |
| 17 | + http_port = lookup(local.cfg, "http_port", local.http_port_default) |
| 18 | + |
| 19 | + https_port_default = terraform.workspace == "apps" ? 443 : 8443 |
| 20 | + https_port = lookup(local.cfg, "https_port", local.https_port_default) |
| 21 | + |
| 22 | + manifest_path_default = "manifests/overlays/${terraform.workspace}" |
| 23 | + manifest_path = var.manifest_path != null ? var.manifest_path : local.manifest_path_default |
| 24 | + |
| 25 | + disable_default_ingress = lookup(local.cfg, "disable_default_ingress", false) |
| 26 | + |
| 27 | + node_image = lookup(local.cfg, "node_image", null) |
| 28 | + |
| 29 | + node_count = lookup(local.cfg, "cluster_min_size", 1) |
| 30 | + nodes = [ |
| 31 | + for node, _ in range(local.node_count) : |
| 32 | + "worker" |
| 33 | + ] |
| 34 | + extra_nodes = join(",", local.nodes) |
| 35 | + |
| 36 | + # on AWS the region is determined by the provider configuration |
| 37 | + # in the local implementation we don't have access to that |
| 38 | + # to still support multi-region setups locally, we hash the availability zones |
| 39 | + # and use that as the region part of the cluster name prefixed with eks- |
| 40 | + cluster_availability_zones_lookup = lookup(local.cfg, "cluster_availability_zones", "") |
| 41 | + fake_region_hash = substr(sha256(local.cluster_availability_zones_lookup), 0, 7) |
| 42 | + fake_region = "eks-${local.fake_region_hash}" |
| 43 | +} |
0 commit comments