https://pulumi.com logo
Title
l

little-notebook-32921

07/22/2021, 11:35 PM
All, any chance anyone could assist me with understanding this message? "error: Duplicate resource URN 'urnđŸ˜›ulumi:hess-net-dev::basevnet:đŸ˜›ulumi:pulumi:Stack::basevnet-hess-net-dev'; try giving it a unique name". I'm looping through a YAML file with GoLang and there seems to be some sort of collision. Any ideas would be much appreciated!
b

billowy-army-68599

07/22/2021, 11:37 PM
can you share your code? it's probably just needing to add an index in your loop
l

little-notebook-32921

07/22/2021, 11:39 PM
I've included the go code and the yaml file!
b

billowy-army-68599

07/22/2021, 11:48 PM
ah, so you have multiple loops with pulumi.Run(func(ctx *pulumi.Context) error {` The error message is telling you that you have two resources with the same name. Each Pulumi program has a parent resource with the provider/stack in it. and because you have 2x
pulumi.Run
functions they're classing. I would change the code to have
pulumi.Run
and then perform your loops of the yaml inside that, that should fix it
l

little-notebook-32921

07/23/2021, 12:08 AM
@billowy-army-68599 could you show me exactly what you're thinking because I'm getting formatting errors all over the place
@billowy-army-68599 nvm got it! Thank you so much for your help. Guess it was just that point in the day lol
b

billowy-army-68599

07/23/2021, 12:14 AM
ha, glad to help! I was just putting something together, but essentially put the
pulumi.Run
in your
main()
l

little-notebook-32921

07/23/2021, 1:15 AM
Also I've been trying to add depends on statements with GoLang and I haven't been able to get them to work, I'm referencing variables outside of for loops like I usually do but to no avail. Resource group isn't created in time and some virtual networks fail. Oh well.
b

billowy-army-68599

07/23/2021, 3:33 AM
If you can share your code I can try help
l

little-notebook-32921

07/23/2021, 2:41 PM
Heres my refactored code. I'm trying to use depends on via the docss at https://www.pulumi.com/docs/intro/concepts/resources/#dependson but I think I'm now having issues with variable scope.