red-processor-68445
10/10/2024, 10:30 AMpulumi.output
meant to recursively to convert something like:
{ foo: { bar: pulumi.Output<string>('baz} } }
to:
pulumi.Output<object>({ foo: { bar: 'baz' } })
?red-processor-68445
10/10/2024, 11:07 AMpulumi.output
does recursively flatten/lift nested outputs to a single outer Output
across objects and arrays, however it specifically excludes `pulumi.Resource`s which halt the recursion:
https://github.com/pulumi/pulumi/blob/d64448ec3b52cf5d4682a70e2f854c9736a86fd8/sdk/nodejs/output.ts#L447-L450red-processor-68445
10/10/2024, 11:07 AMexport const svc = resources.apply((rs) =>
pulumi
.output(
Object.values(rs).map((vs: any) => {
delete vs['__pulumiResource'];
return vs;
}),
)
.apply((vs) => vs.filter((v: any) => v.kind === 'Service')),
);
red-processor-68445
10/10/2024, 11:09 AMred-processor-68445
10/10/2024, 11:09 AM// Don't unwrap Resources, there are existing codepaths that return Resources through
// Outputs and we want to preserve them as is when flattening.
red-processor-68445
10/10/2024, 11:11 AMOutput
so I can use it as part of a predicate in a filter