Is there an easy way to wrap an arbitrary set of f...
# getting-started
l
Is there an easy way to wrap an arbitrary set of functions into pulumi's lifecycle, short of creating an entire provider? eg I'm looking for something similar to the Command provider, but for typescript functions instead of running shell commands.
oh wait, creating a provider doesn't look as complex as I initially thought
t
I've used dynamic providers to do this in the past 🙂
l
I started implementing it and sadly ended up in the same position I have a few times now: due to #2246, it seems pretty difficult to get the correct credentials to use for eg an aws-sdk call
t
Though I do know that lifecycle hooks are on the roadmap: https://github.com/pulumi/pulumi/issues/1691
l
Ooh that would be a good one
t
I wonder if using pulumi esc is an option for you? That's what I've done to inject creds into the environment
l
That might be a workaround, but this is a resource that's going to live in a stack that already has an AWS provider supplying credentials, so ideally I'd be able to inherit the credentials from that provider to initialise aws-sdk to perform my custom task. If I need to create a resource with a different profile within that stack, then this specific resource won't inherit that profile change from the AWS provider, which would get confusing to manage very quickly
t
Oh interesting. I see what you mean. I assume adding an explicit provider and aliasing the current resources isn't an option?
(Or is too laborious to be feasible?)
l
Ideally this would be a 'drop-in replacement' for an existing resource, but potentially, I'll give it a try and see how it feels!
🤘 1