sparse-intern-71089
01/28/2019, 2:20 PMwhite-balloon-205
gray-city-50684
01/28/2019, 2:42 PMgray-city-50684
01/28/2019, 2:43 PMbetter-rainbow-14549
01/28/2019, 2:46 PMgray-city-50684
01/28/2019, 2:47 PMgray-city-50684
01/28/2019, 2:48 PMwhite-balloon-205
can I introduce delay between creating two resources somehow (in Pulumi code)?This should work as a general purpose "delay" that you can use on any
Output
from one resource before passing it to an Input
of another resource. However - it will run every time - not just the first time. Adding the ability to do similar to this only when a resource is newly-created is part of https://github.com/pulumi/pulumi/issues/1691.
/**
* Pause for ms milliseconds and then return the value of the Output.
* @param output The output whose value will be returned aftware pausing.
* @param ms The number of milliseconds to pause.
*/
function pause<T>(output: pulumi.Output<T>, ms: number): pulumi.Output<T> {
return output.apply(v => {
return new Promise(resolve => {
setTimeout(() => resolve(v), ms);
});
});
}
gray-city-50684
01/29/2019, 12:29 PMwhite-balloon-205