loud-sugar-50419
07/16/2019, 6:37 AMreturn (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 (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 ?