Hello all :slightly_smiling_face: I'm looking to ...
# pulumi-deployments
c
Hello all 🙂 I'm looking to create roles/Schemas etc.. with pulumi to a remote postgresql database. Everything works fine except that if I launch twice the deployement the second will give me "error creating XXX because XXX already exists". The only thing I have for now is to wrap everything in big try{ // try to get the ressource } catch {// create it} Anyone have a better solution ?
l
When you launch it the 2nd time, is it with clean state? If the resource is managed by Pulumi, it should work. If you're removing state, or running it somewhere that doesn't have access to the original state, then what you're seeing is expected.
For example, if you're using local state and running if from different machines. Or even if you're running it from different Docker instances without having bind-mounted the correct ~/.pulumi.
Also, this question would probably go better in #general. This channel is for questions about the Pulumi Deployments feature.
c
Sorry for the long delayed response. I'm running it with the same machine, same setup with few hours difference, but I will ensure that my state is correct (but it should be...)
l
If you can see the resource in state (same Pulumi type and Pulumi name) and it causes that error, then there's a problem: raise an issue in the provider's GitHub repo. If the resource is the same but the Pulumi type or name doesn't match, then the problem is the code: you're trying to create the same thing twice.