04/24/2023, 4:33 AM
Hello. I am using the Pulumi Automation API to automate my infrastructure. Here I have some generative code that creates Resources for me. Now, if I want to create a RabbitMQ Resource, I need to call
new Resource
... with a password, that is auto-generated on the fly. As soon as I hit the same code next time, I don't have that password any longer. I don't want to generate a new password everytime I run the same code, so I'd rather try to see if the resource already exists and load this, instead of creating a new one. Is there a way how to do that? The documentation is not quite clear on this. Also, I have a Dynamic Resource where I do this myself. I see that there is the read() Function for, I assume, this case. But I don't find any way on how to trigger this function during my automation code. Any pointers to documentation, example code, or what to search for would be much appreciated


04/24/2023, 6:16 AM
how is that password generated on the fly? we do use
for generating passwords (secret) that don’t change in the same state


04/24/2023, 7:31 AM
I use automation api to provide my own system. I basically have my own infrastructure json where some resources in there will be managed by pulumi code. But for Pulumi I need to do the whole
new resource
thing for my resources to keep them. But as the password is being ultimately saved in 1password, I don't want to update it every time. PLUS I try to prevent having to load each password while going through the infrastructure, as I have my own marker if resources need to be changed


04/24/2023, 12:25 PM
@cuddly-easter-41456 have you tried the
resource to generate stable passwords? This will also declaratively create a new password once and use the same password on every next run of the same stack.


04/26/2023, 5:53 AM
I will have a deeper look into this, thanks