I'm trying to work with an object with variously n...
# general
r
I'm trying to work with an object with variously nested
pulumi.Output
values. Judging by this comment: https://github.com/pulumi/pulumi/blob/d64448ec3b52cf5d4682a70e2f854c9736a86fd8/sdk/nodejs/output.ts#L425-L441 I would expect
pulumi.output
to convert all nested outputs to a single top-level output so that when I run
apply
on it I can work with the raw values within the passed function. I am trying to examine the resources created by
k8s.helm.v3.Chart
(but I don't think that has much bearing on the question). If I run:
Copy code
export const resources = pulumi.output(blockscoutChart.resources);
// @ts-ignore
export const svc = resources.apply((rs) => Object.values(rs).map((r) => (r as any).kind.apply((k) => k === 'Service')));
Then I get:
Copy code
[
  false,
  true,
  true,
  false,
  false
]
Which since
apply
exists implies the values of the
kind
key are still
pulumi.Output
despite calling
pulumi.output
on
resources
, and so explains why what I actually want to do isn't working:
Copy code
export const svc = resources.apply((rs) => Object.values(rs).filter((r) => (r as any).kind === 'Service'));
returns
[]
rather than the second and third
Service
resources where the predicate
.kind === 'Service'
is true. Have I misunderstood what
pulumi.output
does, how can I achieve what I want?