https://pulumi.com logo
Title
d

damp-honey-93158

05/04/2022, 9:10 AM
Does anyone have sample code showing how to create an (azure) provider, that is then used implicitly with another resources that DO NOT specifically take a provider instance? I've got a c# library of code that constructs stuff, non of it should care about which provider is being used in my opinion - so I definitely do not want to be forced to inject a "provider" arg into every single ctor, that seems like a code smell. I've just noticed now that when I provide a resource with a ComponentResourceOptions instance (for example, to ensure a RG is retained on delete); then my default provider is entirely ignored and the RG doesn't even get created.
e

echoing-dinner-19531

05/04/2022, 10:35 AM
If the resources are parented under a ComponentResource you can just set the providers map once for that component and the children will inherit it.