Making progress with Terraform |
Provider alias
The first thing is to configure the IBM provider twice and give it an alias. I used "team_account" for the alias (and of course a different API key!). That configuration can / must be referred to as "ibm.team_account". One such use is in the required_providers section where I added a configuration alias (see below).
A provider without an alias is considered the default provider.
Working with resources
Later, when working with resources and data sources, I had to add the desired provider to each section or it would be the default provider.
The above retrieves the account settings from the second account, the "team_account". Another example is to obtain the resource group information to deploy resources to or read information about some service instances.
Conclusions
It is easy to work with multiple IBM Cloud accounts within the same Terraform environment. Just define provider aliases and refer to them when needed.
UPDATE (2022-10-18): See this GitHub repository for sample code.
If you have feedback, suggestions, or questions about this post, please reach out to me on Twitter (@data_henrik) or LinkedIn.