Is there a way to delay for x seconds after one re...
# azure
b
Is there a way to delay for x seconds after one resource is created but before another is created? When I create my Azure Service Principal, and then create an AKS Kubernetes Cluster with that Azure Service Principal, sometimes it fails because replication of the Service Principal needs to occur. If I could just delay by 30 seconds or so after the Service Principal is created and before it starts creating the AKS Kubernetes cluster, it would allow my pipeline to pass first time without having to re-run as I do currently.
w
Yes - you can do something like https://gist.github.com/lukehoban/fd0355ed5b82386bd89c0ffe2a3c916a#file-waitforjob-ts-L20 (though simpler). Schematically it looks like:
Copy code
var x = new Res1();
var y = new Res2({
  input: x.output.apply(async (o) => {
    if (!pulumi.runtime.isDryRun()) {
      await sleep(1000);
    }
    return o;
  }),
});
b
Wow - amazing - thanks @white-balloon-205 - I've been looking everywhere for a solution and tried lots of clunky things - will give it a go