@virtualbubble wrote:
I there a way to loop through template files? I would like to provide a list of filenames and get terraform to loop through them.
Is it possible to use the for or foreach?
variable "dashboard_config" { type = list default = ["dashboard1.tpl","dashboard2.tpl"] } resource "azurerm_dashboard" "azurerm_dashboard" { resource_group_name = "dashboards-rg01" location = "eastus" dashboard_properties = templatefile(var.dashboard_config, { dashboard_name = "dashboard-${var.service_name}" }) }
I have tried the following it does loop through but have issues with the required format for dashboard properties and the to string breaks. This is documented and expected.
dashboard_properties = tostring([ for name in var.dashboard_config: templatefile(tostring(name), {
Posts: 1
Participants: 1