I am trying to find a way to declare one output that could loop through multiple module names but am a bit stuck and not sure if it’s possible to achieve this.
I have terraform files with a consistent naming scheme such as <MODULE>.tf
and my module has the same name inside that file.
I was able to create a local list of files with the .tf suffix trimmed off so this list contains strings of just <MODULE>
In my output I am trying to set
value = [for i in local.trimmed_file_suffix: module.i.arn]
But get an error message saying that i
is not a declared module. I’ve also tried using ${i}
and "${i}"
in an attempt to get the variable to expand but this gives the same error message about not having a declared module named i
.
Is it possible to achieve what I am trying to do?