Hello, i am implementing my first dynamic Resource...
# typescript
s
Hello, i am implementing my first dynamic Resource. It looks to me that the type of any dynamic resource is hard coded to :
pulumi-nodejs:dynamic:Resource
. This generate duplicate resouce URN when the name of 2 different resource are the same . Is there a way to fix this ?
l
You should subclass that, and pass in your own type string as the 2nd parameter to the constructor
s
i am not sure which class to subclass, do you have a short example @little-cartoon-10569
l
I can't find one in the examples repo. Here's one from the docs: https://www.pulumi.com/docs/intro/concepts/resources/#authoring-a-new-component-resource
It's a single-line example, but that's because it really is that simple...
That example is for a component resource, but the same applies to resources created by dynamic providers. E.g.; https://www.pulumi.com/docs/intro/concepts/resources/#dynamic-resource-inputs
The
pulumi.dynamic.Resource
class is subclassed, and the 2nd parameter (name) is where the type info goes (line 301). Not sure why it was done this way, instead of with a type and name like in component resources...
s
that's awesome!!! thks @little-cartoon-10569
👍 1