In terraform, I'm using user_data to initiate a windows server instance. Locally, I have a folder with several files. Each file contains a single line.
In my user_data PowerShell script, I would like to create a single file containing the concatenation of all the lines in my local files.
An example is better than words:
locally, I have:
$ ls my_folder
file1
file2
$ cat file1
foo
$ cat file2
bar
In terraform user_data:
PS> New-Item C:\my_file
for file in my_folder
cat file in my_file
How can I do this in terraform?
Thanks
It would be easier to accomplish this in Terraform than wrapped inside the Powershell:
Use a for expression to iterate through the output enumerable of all files in the folder return by
fileset, and then collect their contents as a string return element withfile. We thenjointhe list into a singlestring.