https://pulumi.com logo
f

full-artist-27215

09/29/2021, 6:24 PM
Is there any way to get an explicit reference to a default provider instance inside a Pulumi program?
p

prehistoric-activity-61023

09/29/2021, 6:41 PM
I haven’t found anything in the docs explicitly but I managed to get default provider (although I tested it on my custom ComponentResource where provider was overridden using
opts
):
Copy code
gcp_provider = cast(gcp.Provider, self.get_provider("gcp::"))
that’s a python example so this
cast
is only to satisfy
mypy
f

full-artist-27215

09/30/2021, 4:44 PM
That's handy inside a resource, but I haven't been able to track down how to grab a default provider from the top-level of a Pulumi program. Anybody else have any thoughts on this?
2 Views