hi :slightly_smiling_face: another completely unre...
# azure
b
hi 🙂 another completely unrelated question to the one above: How do you guys deal with race conditions? I've a pulumi script to make an event grid topic, upload a function, and subscribe the function the grid. This doesn't work when updating the function already exists. Then the upload / update function isn't finished yet when pulumi tries to make the subscription. However, Azure points out that it cannot make the subscription yet due to that the function hook does not exist (yet). As a result, the pulumi script crashes. Is there a prefered way to deal with these kind of sequential constraints?
b
Hi Emile, the
dependsOn
mechanism will help here, but if you're passing outputs from one resource to another, Pulumi should be able to figure out the dependencies and ensure the resources are created in order. Can you share the code you have?
b
Thnx! It's quite a big project, but I can try to take a snippet 🙂 I think that the `dependsOn`would not work due to that Pulumi thinks that the azure function has already been updated; azure is too fast with returning control
My workflow up to this point was this: 1. Made a simple function with only a http trigger 2. Deployed that using the file archive 3. Extended pulumi script with event grid and topic 4. Extended function with an event trigger on said topic 5. Build the function 6. Tried to deploy with pulumi - which updated the function, made the event grid and topic, but crashed on making the subscription 7. I restarted the azure function using the portal 8. Redeployed pulumi, now it works Now I'm searching for a pattern with which I can automate the deployments. I like the idea of having Pulumi in charge of the whole state, so I'm curious on whether I can do this without the manual step 🙂
t
b
Something like that would probably work in this case! Thanks! 😄
b
apply()
always has the answer!
b
apparently 🙂