https://pulumi.com logo
Title
s

some-church-49045

01/01/2022, 3:50 AM
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

little-cartoon-10569

01/03/2022, 7:47 PM
You should subclass that, and pass in your own type string as the 2nd parameter to the constructor
s

some-church-49045

01/06/2022, 12:13 AM
i am not sure which class to subclass, do you have a short example @little-cartoon-10569
l

little-cartoon-10569

01/06/2022, 12:18 AM
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

some-church-49045

01/08/2022, 9:15 PM
that's awesome!!! thks @little-cartoon-10569
👍 1