Results in the usual ``` Calling [toJSON] on an [...
# typescript
m
Results in the usual
Copy code
Calling [toJSON] on an [Output<T>] is not supported.


            To get the value of an Output as a JSON value or JSON string consider either:
                1: o.apply(v => v.toJSON())
                2: o.apply(v => JSON.stringify(v))

            See <https://pulumi.io/help/outputs> for more details.

            This function may throw in a future version of @pulumi/pulumi.
l
This is caused because you're calling
stringify()
on a an object that contains outputs. You're calling
apply()
on k0sconfig which is necessary, but k0sconfig itself contains outputs.
You have a few options here, such as delegating to Pulumi like Stew suggests. Or adding parameters to
all()
(are apiVersion and kind outputs?) and nesting calls to
apply()
(are n.role and n.ip outputs?).
Or you could find the nested-unwrapping logic that Pulumi uses and see if you can call it yourself, or rewrite it.
o
Looking at your
k0sconfig
declaration, I see
k0sctrl.apiVersion
and
k0sctrl.kind
inside the body of the function - are those outputs as well?
l
Great minds think alike 🙂 That was my question 2 lines up ☝️
o
oops
l
It's possibly cleaner (not sure on how it looks in Python) to update
pulumi.all()
to have
nodes
and
k0sctrl.kind
as parameters. Achieves the same thing without having to await a promise inside the block.
o
yep, was just about to share that!
l
We're on the same ideas-train today! 🙌
o
l
Not sure why I thought all this was in Python.. I'm answering too many questions, maybe...