stupid question, is there a way to wait in pulumi?...
# python
l
stupid question, is there a way to wait in pulumi? i'm hitting a problem where pulumi cannot detect the azure ad application, i suspect its a race, because if I rerun it works fine
c
@little-river-49422 (what a name you have btw) you should be able to just depend on a promise with a timeout
you must be booting AKS, right?
This is annoying and is indeed an Azure issue.
l
yeah, i'm booting aks
it works fine if I precreate azure ad application
but if I create it in the same run it fails
c
If you rerun it, it usually works. It’s so annoying.
It is a race somewhere in Azure’s API
l
well, my name ensures unique identified for me across all the possible services on this planet 😉
so there is way to just sleep after creating for a minute?
c
that must be the old feature you look for in a name? lol
l
🤣
c
I forget the exact incantation… @bitter-oil-46081 you are good at javascript, if someone wanted to wait for like 10 or 20 seconds between two resource creations what woudl you do?
only* feature
l
i suppose I can make everything depend on everything, so it takes as much time to do it
c
you should already be depending on the AD principal and stuff, I think
l
well, being unique is kinda important, yeah, nobody remembers how its spelled, but they always know its me 🙂
yeah, but when app is created its not available isntanly, its kind of a known azure thing
or maybe, there is a retry mechanism in pulumi
that would be better
c
oh right
python
my b
this I really don’t know
l
well, retry, if exists, wont be unique to python 😉
c
I was going to suggest some kind of
setTimeout
but that’s the wrong language
we do retries sometiems. Mostly in kubernetes.
b
In js you can do the following:
Copy code
function sleep(ms: number) {
                    return new Promise((resolve) => {
                        setTimeout(resolve, ms);
                    });
                }
And then await the promise.
I think In python you could just call sleep.
c
But in Python… do they have promises?
l
mm, let me try something
w
So - just to be clear - this is a bug in the underlying Terraform Azure provider - and you should not have to manually wait. It is part of the contract of creating a resource that it is ready to be interacted with after completing creation. I believe we thought this was fixed with https://github.com/terraform-providers/terraform-provider-azurerm/pull/2204, but it seems like perhaps it is not. Regardless, it should be possible to add a wait per what @bitter-oil-46081 and @creamy-potato-29402 are suggesting - I just want to be clear that is working around a bug, not something you should need to do in the limit.
l
i know 😉
👍 1
ok, i'll probably push first draft tomorrow, its 1.20 here
thanks folks, best of luck. later.