AzureRM provider feature block and usage with Modules for_each/count in TF 0.13+

Trying to figure out how this can be done. I am trying to write reusable modules that uses AzureRM, and that requires a provider definition for the module to be tested and validated, because it needs the features {} block.

However when I try to use this module in a root configuration, it complains that it contains provider blocks, which is not allowed when using the for_each/count declarations.

Is there a way to get around this?

  • If I remove the provider block, module cannot be initialized, validated and tested individually
  • Code is super messy in the root if I have to define each and every case individually, but this allows me to keep the provider block.
    Any idea on how to get around this?