I have about 20 web applications that are created the azurerm_windows_function_app resource. These web applications all generally have the same configuration. But two of them will have virtual applications defined. Ideally, I would like to some how define these virtual applications better than what I'm currently doing while maintaining the for_each loop I use to generate these resources. I make use of a module that defines all of the default settings and call that module in the main.tf.

Currently, I'm using azurerm_resource_group_template_depoyment to apply the virtual applications because setting the virtual application was not possible in older versions of the azurerm provider. But now this capability is available with the azurerm_windows_function_app and would like to make use of it.

I'm honestly not sure if there is a design pattern I'm not familiar with to achieve this, or if I am still required to use the azurerm_resource_group_template_deployment resource.

1

There are 1 answers

0
pieter-jan goeman On BEST ANSWER

I would create all the needed variables separately in the module variable file, and give the a default value, the value most of the resources need. Then, I'd make a set or map of objects, which will each represent a web app, where you only put values for webapps that need others than the default. If no value is present, the webapp will be created with the default values.