07/16/2019, 6:37 AM
hi new to typescript and pulumi trying to move from terraform I was implementing the idea of tdd based on the blog by Joe Duffy Had the following issue with promise function demo by Joe Duffy
return (output as any).promise() as Promise<T>;
when I try to export a security group const awsx.ec2.SecurityGroup and then try to test all the ingressRules which is an array it will fail as there is no promise function to the array. So I changed the promise if the output is not of type OutputImpl then convert it to an output and then use it
export function promise<T>(output: pulumi.Output<T>): Promise<T | undefined> {
    if ( != 'OutputImpl'){
        return (pulumi.output(output) as any).promise() as Promise<T>;
       return (output as any).promise() as Promise<T>;
and then in the spec test I got the array[]
const ssh_rule:Array<awsx.ec2.IngressSecurityGroupRule> | undefined = await promise(baseVpc.baseSgObj.ingressRules);
how do I get all the cidrblocks as If I call the promise function
specifying the array index it will work as the object implements an output which has a promise. How to convert pulumi output back to its original form ?