Proper use of modules in Terrafile


I have attempted to use a module in the Terrafile (as described in Terrafile - Terraspace). I stumped upon an issue with the azurerm_resource_group, which is declared as data in As far as I understand the Terraform docs, the data means that the resource group must have been created before and exist at the time of creating the stack with Terraspace. However, in our Terraspace app the resource group is created along all other resources, and so I get an error from the module that the resource group could not be found.
Because of that I cannot use the vendor module verbatim, but must copy its code to app/modules and get rid of the data “azurerm_resource_group” “this” declaration to be able to use the rest of the code.
Is there any solution that would allow me to use the vendor module code without any modification?
Any help will be much appreciated.


Not completely following. Let’s pretend terraspace is not involved at all here, but we’re using only pure terraform. In that case, believe would still need to have the existing azurerm_resource_group that the module you’re using expects. So in either case, you have to create the existing azurerm_resource_group ahead of time so the data source can reference it. Maybe missing something though.

I ended up using the vendor modules as a basis for our app modules. They need some customization anyway, as they don’t cover all available options. So at this time I find the Terrafile usefulness limited.
But generally I find Terraspace a great tool that fulfills our expectations and purpose.