Allow same filename in different directories
As long, as they do override default project name using `name`.
This commit is contained in:
committed by
Wiktor Niesiobędzki
parent
4769dc3dd7
commit
d63a425b62
@@ -35,7 +35,7 @@ locals {
|
||||
]
|
||||
])
|
||||
}
|
||||
output "foo" { value = local.automation_buckets }
|
||||
|
||||
module "automation-bucket" {
|
||||
source = "../gcs"
|
||||
for_each = local.automation_buckets
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
# tfdoc:file:description Projects factory locals.
|
||||
|
||||
locals {
|
||||
_hierarchy_projects = (
|
||||
_hierarchy_projects_full_path = (
|
||||
{
|
||||
for f in try(fileset(local._folders_path, "**/*.yaml"), []) :
|
||||
basename(trimsuffix(f, ".yaml")) => merge(
|
||||
trimsuffix(f, ".yaml") => merge(
|
||||
{ parent = dirname(f) == "." ? "default" : dirname(f) },
|
||||
yamldecode(file("${local._folders_path}/${f}"))
|
||||
)
|
||||
@@ -28,13 +28,16 @@ locals {
|
||||
}
|
||||
)
|
||||
_project_path = try(pathexpand(var.factories_config.projects_data_path), null)
|
||||
_projects_input = merge(
|
||||
{
|
||||
for f in try(fileset(local._project_path, "**/*.yaml"), []) :
|
||||
basename(trimsuffix(f, ".yaml")) => yamldecode(file("${local._project_path}/${f}"))
|
||||
},
|
||||
local._hierarchy_projects
|
||||
)
|
||||
_projects_full_path = {
|
||||
for f in try(fileset(local._project_path, "**/*.yaml"), []) :
|
||||
trimsuffix(f, ".yaml") => yamldecode(file("${local._project_path}/${f}"))
|
||||
}
|
||||
_projects_input = {
|
||||
# will raise error, if the same filename is raised multiple times
|
||||
# and project name is not set via name in YAML
|
||||
for k, v in merge(local._hierarchy_projects_full_path, local._projects_full_path) :
|
||||
lookup(v, "name", basename(k)) => v
|
||||
}
|
||||
_project_budgets = flatten([
|
||||
for k, v in local._projects_input : [
|
||||
for b in try(v.billing_budgets, []) : {
|
||||
|
||||
Reference in New Issue
Block a user