https://pulumi.com logo
Title
l

little-river-49422

02/15/2019, 10:05 PM
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

creamy-potato-29402

02/15/2019, 10:06 PM
@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

little-river-49422

02/15/2019, 10:06 PM
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

creamy-potato-29402

02/15/2019, 10:07 PM
If you rerun it, it usually works. It’s so annoying.
It is a race somewhere in Azure’s API
l

little-river-49422

02/15/2019, 10:07 PM
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

creamy-potato-29402

02/15/2019, 10:08 PM
that must be the old feature you look for in a name? lol
l

little-river-49422

02/15/2019, 10:08 PM
🤣
c

creamy-potato-29402

02/15/2019, 10:09 PM
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

little-river-49422

02/15/2019, 10:09 PM
i suppose I can make everything depend on everything, so it takes as much time to do it
c

creamy-potato-29402

02/15/2019, 10:09 PM
you should already be depending on the AD principal and stuff, I think
l

little-river-49422

02/15/2019, 10:09 PM
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

creamy-potato-29402

02/15/2019, 10:10 PM
oh right
python
my b
this I really don’t know
l

little-river-49422

02/15/2019, 10:11 PM
well, retry, if exists, wont be unique to python 😉
c

creamy-potato-29402

02/15/2019, 10:11 PM
I was going to suggest some kind of
setTimeout
but that’s the wrong language
we do retries sometiems. Mostly in kubernetes.
b

bitter-oil-46081

02/15/2019, 10:11 PM
In js you can do the following:
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

creamy-potato-29402

02/15/2019, 10:12 PM
But in Python… do they have promises?
l

little-river-49422

02/15/2019, 10:12 PM
mm, let me try something
w

white-balloon-205

02/15/2019, 10:14 PM
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

little-river-49422

02/15/2019, 10:15 PM
i know 😉
👍 1
ok, i'll probably push first draft tomorrow, its 1.20 here
thanks folks, best of luck. later.