Howdy everyone, I'm trying to determine if an issu...
# typescript
Howdy everyone, I'm trying to determine if an issue I have is a bug within the typescript packages of Pulumi, I notice some inconstancy between
I posted the details here because I was unsure: What I notice is that
automatically unwraps the underlying value of its endpoint, while
does not. So for
one needs to use the
operator again in order to use the underlying value of
and get the actual endpoint. This seem like a bug to me - it seems to me that the outputs should be handled in the same way across packages 🤷‍♀️ Regardless I was able to come up with a workable solution but any comment or feedback is appreciated.
No, that's normal. Note that outputs are unwrapped automatically for you when used as inputs. So while you can't get at
in your code (for example, you can't loop through it because the array is inside the Output), you can pass
as a parameter to another Pulumi constructor. In JS/TS, Pulumi has some clever way of promoting the
to inside the output. It's magic.
In your example in the GitHub issue, I think you're comparing Instance.endpoint (type: Output<string>) with Cluster.cacheNodes (type: Output<ClusterCacheNode[]>). The important difference is that in cacheNodes, the type that the Output wraps is an array.
You have this as your problem example:
Copy code
this.RedisSetupOutput = {
      redishost : redis.cacheNodes[0].apply(a=>a.address),
      redis: redis
This is needed because the code isn't somewhere that Pulumi unwraps inputs for you. If you were passing the address to a Pulumi constructor, you could do this:
Copy code
new, {
  address: redis.cacheNodes[0].address
In this context, Pulumi is able to sort it all out for you.
Thanks for explaining this!