Conditionally create a module + necessary provider

Hello terraform community,

I want to build a Multi Cloud setup using one module per Cloud Provider.
The user of the terraform script can decide which Cloud provider module he wants to use. I wanted to let the configure that via tf variables.
However if the module is deactivated (using count = 0) terraform still tries to load the provider and its credentials. Which is not working because the user don’t has set up credentials for it.
When using e.g. terraform apply -target to restrict the apply to the needed module it is not loading the other providers…
My question is how to set up module using configuration variables to act the same way that -target does?

To implement this kind of pattern in Terraform, it is necessary to maintain entirely separate implementations of your module, one for each cloud provider, under different names, and have the user select the flavour of your module they want.

Terraform doesn’t implement conditional providers.