we were looking forward to the count + for_each feature on modules quite some time and are very happy that it made it now to 0.13. Thanks for your good work!
But we are struggling a bit with the implementation for our use-case. We have one terraform repo with modules for different cloud providers (aws, gcp, azure). The modules share the input variables. Only one of that modules will be applied, depending on user decision. At the moment we use resource targeting to only run one module for the cloud-provider of choice t achieve that.
Now with the new count possibility we wanted to get rid of the targeting, as it has some other side effects. So the idea is, depending on a input variable only the desired cloud-provider module gets enabled and applied (count=1) and the others don’t.
But this does not work, because all of the terraform providers have to be configured top-level (no nested provider configs allowed) and need valid specs (e.g. auth credentials) set.
How can we achieve that? Our users can only provide settings for one specific provider.
Any ideas on how to maybe restructure the layout of the modules to achieve that, without targeting the module on every apply using the count on modules?
Thanks & Greetings,