Hi everyone! How can I define a dependency between...
# general
Hi everyone! How can I define a dependency between a resource and a getter in my code? In my case, I have a PagerDuty ServiceIntegration resource created, and right after that, I need to call getServiceIntegration. I do that because right after the resource is created, a key is generated on the service provider and I'd like to retrieve that. Somehow it's not a part of the resource outputs. Of course, the
pulumi preview
fails because it tries to invoke the getter even if the resource doesn't exist yet. I can't use the
argument as
has because
doesn't support that. Many thanks.
Can you split the project into two? One that prepares the integration, and one that uses it?
Which key does the resource not provide?
The integrationKey property is available on the resource. It's listed under inputs, because it can be provided or generated.
Hey @little-cartoon-10569, thanks for the answer. I ended up generating the
on my side just like you said and provided it as part of the resource, but I was curious if there's a feature on Pulumi supporting the
functionality between a resource and a getter
Those getters aren't really getters, they're nice wrappers around the SDK. They don't return resources, they just return dependency-less results objects. Therefore, they probably don't honour the dependsOn opt.
For some reason, the InvokeOptions link isn't taking me anywhere, so I can't confirm what type it is even...
You can use ServiceIntegration.get(), which will honour the dependsOn option.
But if the integrationKey is really output from the ServiceIntegration resource when it's not provided as an input, then that's the way to go in this case. If it's not, then what you did is best.
Great, thanks again @little-cartoon-10569!