17 lines
494 B
HCL
17 lines
494 B
HCL
locals {
|
||
# 1. Collect every matching file – paths are relative to templates_dir
|
||
template_files = fileset(
|
||
"${path.root}/${var.templates_dir}",
|
||
var.file_pattern
|
||
)
|
||
|
||
# 2. Build a map: group-name → { content = <file-text> }
|
||
# We strip the extension to get a neat group name.
|
||
templates = {
|
||
for rel_path in local.template_files :
|
||
trimsuffix(basename(rel_path), ".tmpl") =>
|
||
{
|
||
content = file("${path.root}/${var.templates_dir}/${rel_path}")
|
||
}
|
||
}
|
||
}
|