locals { # CONFIGS workspace = (terraform.workspace == "default") ? "azdo-lcu-pipelines-platform" : terraform.workspace lz_config = yamldecode(file("./config-files/${local.workspace}.yaml")) platform_configs = yamldecode(file("../shared-terraform-configurations/df-platform-configs.yaml")) aks_service_connections = { qa = "svcon-sub-df-lcu-apps-qa-aks-k8s-uscz" uat = "svcon-sub-df-lcu-apps-uat-aks-k8s-uscz" prd = "svcon-sub-df-lcu-apps-prd-aks-k8s-uscz" } pipelines = { for v in setproduct(local.lz_config.aks_workloads, local.lz_config.pipeline_definitions) : "${v[0].repo}-${v[1]}" => { pipeline_folder_path = v[0].path repo = v[0].repo pipeline_name = "${v[0].repo}-${v[1]}" suffix = v[1] pipeline_path_prefix = lookup(v[0], "pipeline_path_prefix", "") aks_auth = try(v[1] != "feature-branches") ? local.aks_service_connections["${v[1]}"] : null environment_auth = try(v[1] != "feature-branches" && lookup(v[0], "environment", null) != null) ? "${v[0].environment}-${v[1]}" : null } } environments = compact(distinct(flatten([ for v in setproduct(local.lz_config.environments, local.lz_config.pipeline_definitions) : ["${v[0]}-${v[1]}"] if v[1] != "feature-branches" ]))) # default to none if the key is missing db_approval_env_suffixes = try(local.lz_config.db_approval_env_suffixes, []) # build the actual environment names (DB-qa / DB-uat / DB-prd) db_approval_env_names = toset([ for s in local.db_approval_env_suffixes : "DB-${s}" ]) }