No, that's normal. Note that outputs are unwrapped automatically for you when used as inputs. So while you can't get at
redis.cacheNodes[0]
in your code (for example, you can't loop through it because the array is inside the Output), you can pass
redis.cacheNodes[0]
as a parameter to another Pulumi constructor. In JS/TS, Pulumi has some clever way of promoting the
[0]
to inside the output. It's magic.
little-cartoon-10569
02/03/2022, 9:58 PM
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.
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 aws.xyz.SomePulumiClass(name, {
address: redis.cacheNodes[0].address
});
In this context, Pulumi is able to sort it all out for you.
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.