hi new to typescript and pulumi trying to move fro...
# typescript
l
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 https://www.pulumi.com/blog/unit-testing-infrastructure-in-nodejs-and-mocha/ 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
Copy code
export function promise<T>(output: pulumi.Output<T>): Promise<T | undefined> {
    if (output.constructor.name != 'OutputImpl'){
        return (pulumi.output(output) as any).promise() as Promise<T>;
  }else
    {
       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
promise(baseVpc.baseSgObj.ingressRules[0].securityGroupRule.cidrBlocks)
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 ?