Hi, I am working with Pulumi typescript and follow...
# general
s
Hi, I am working with Pulumi typescript and following the kubernetes getting started example. at one point we get the IP address of a service
Copy code
const ip = frontend.status.loadBalancer.apply(
    (lb) =>  lb.ingress[0].ip || lb.ingress[0].hostname
);
I am trying to use this IP in a client (Browser) application configuration. But I am not able to convert it into a string . I tried different methods including
Copy code
ip.apply(i => `http://${i}/abc`)
Second
Copy code
pulumi.interpolate `http://${ip}/abc`
Third
Copy code
pulumi.concat(`http://`, ip, `/abc`)
Every time I get the same error,
toString()
is not supported, or
toJSON()
is not supported. Can someone help me please ?
a
All 3 options return an
Output<string>
, and you can’t call
toString()
or
toJSON()
on outputs.
Output<T>
is are similar to a promise, in that it represents a value that might not be present. Because an
Output<T>
might not ever resolve (for example, during
pulumi preview
), it can’t be awaited. You need to put whatever needs a raw
string
inside an
apply
.