This is in TF V0.12 if that helps
In a directory, I have a variable number of single-line files.
I need to somehow read the contents of them all concatenating them with a newline between and store the result into a single variable. (not an array of strings)
I know I can get the list of files to read using:
locals{
my files=tolist(fileset("${var.file_path}", "**")) }
And if I only had a single file I know I can read in the contents by using
locals {
file_value=file("${var.file_path}\\${local.my_files}") # if there was only a single file
}
But my brains just turned to cotton wool how I can do the read for multiple, I feel like I should be using a count and a concatenate within a null resource but can't seem to work the logic out. Is that the right path or how should I be doing it?