pulumi providers that are based on terraform - is ...
# general
pulumi providers that are based on terraform - is there a way to have them auto generate resource names?
it should do that as part of the bridge, is there something not working?
not sure
im using the vsphere module, which is based on TF
resource_name is not option, so I am just providing “VirtualMachine” as resource name, and I was hoping that it will be prefixed or suffixed with a random id
but instead, if I attempt to create two VM’s, the 2nd will complain about lack of URN uniqueness
can you share your code?
let me create a simplified example
btw your public repo’s help me a lot to create pulumi provider + build pipeline from a tf module, so thx for that :)
glad you're having success!
well, its not simplified, sorry about that
line 163 is the one that causes the issues
basically, if I dont ensure that its unique, I will get errors like
vsphereindexVirtualMachine (VirtualMachineAAA): error: Duplicate resource URN ‘urnpulumidev:vinci pulumi win desktopvsphereindex/virtualMachineVirtualMachine:VirtualMachineAAA’; try giving it a unique name```
if you specify the name of the machine, it won't autoname, if you remove that it should work
ah you are right
its the name attribute
that prevens the auto naming, the guide even said so
I missed that, sorry
thx for pointing it out
I dont get it
let’s say I have this
is this supposed to work?
no, the names are the same, it should be:
Copy code
import pulumi_random
a = pulumi_random.RandomPassword("password-a", length=8)
b = pulumi_random.RandomPassword("password-b", length=8)
the names need to be unique properties
ok, so I do have to ensure that the resource name is unique?
that's right
I see
so what’s the best way to deal with that if I want to automate that, but also dont want to resource names to change on each run?
the resource names shouldn't change on each run, it's a declarative state
what would you need to automate?
im trying to create simpler interfaces for the resources I want to use, and ideally, the users of the simplified resources wouldnt have to deal with resource names
sorry I'm havinga hard time understanding 😞 If you're creating a component you don't always need to specify the names of each resource, but the component itself still needs a name when it's declared
I will revisit this tomorrow with a fresh pair of eyes
thanks for your help, much appreciated