Hi, Is possible to run pulumi code using multiple ...
# general
Hi, Is possible to run pulumi code using multiple cloud providers at the same time? I need to create resources in azure and aws when pulumi is executed: ej: const vnetwork = new vnet.Vnet('VirtualNet',{resourceGroup}); //for azure provider =new aws.Provider({....}) const main = new aws.ec2.Vpc("main", { //for aws cidrBlock: "", },{provider:provider }); I have tried setting the providers but always I'm loosing the credentials: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found. If I comment the azure line it starts working.
I've never done this but I would try declaring a
and an
and I would make sure to always pass them to the appropriate resource - is that what you're doing?
Here is an kubernetes-ts-multicloud example that has multiple different providers that you can view that will help out.
👀 1
thanks I will take a look at that
I've done it, it works a treat. You use exactly the same technique to deploy to different AWS regions.
You need to be diligent about passing providers around. While resources inherit providers from their parent resources, I've found it's a good idea (from a code clarity point of view) to not rely on this, and instead pass the correct provider to every resource, always.
If nothing else, this ensures that resources still work even if you forget to set their parent 🙂
resources inherit providers from their parent resources
I actually didn't know this. My component resources have always just passed the provider all the way down 🤦‍♂️