Init multiple providers using JSON files

Hi all!

I´d like to initiate multiple providers (all OpenStack) for different environments using JSON files or some other file format. What I thought I could do is to read those JSON files with an external data source (using base64 encoding as Terraform only handles single string JSON), which does work fine so far. But unfortunately there is no COUNT or FOR_EACH in the provider section allowed.

data "external" "providers" {
  program = ["bash", "${path.root)/../../"]
  working_dir = "${path.root}"

output "providerdata" {
  value = jsondecode(base64decode(data.external.providers.result["providers]))

What the shell script does is to read every single JSON configuration file in a specific folder, merges them as single JSON data and echoes it back using base64 encoding. Nothing special. Those JSON files contain information like auth_url, user etc. for every single provider.

Any ideas / workarounds on that issue? Man, having COUNT/FOR_EACH in provider would be such a great thing. :wink:

Thanks and best regards,