https://pulumi.com logo
#aws
Title
# aws
a

adorable-summer-21974

08/01/2023, 2:22 PM
Getting Elasticache (redis) endpoint, getting stuck on this one: Create cluster: ``const redisCluster = new aws.elasticache.Cluster(/* ... *?)` Try to fetch endpoint:
redis://${redisCluster.cacheNodes.apply(nodes => nodes[0].address )}:6379
Results in:
Calling [toString] on an [Output<T>] is not supported.\n\nTo get the value of an Output<T> as an Output<string> consider either\n1 o.apply(v =>
prefix${v}suffix
)\n2: pulumi.interpolate `prefix${v}suffix`\n\nSee https://www.pulumi.com/docs/concepts/inputs-outputs for more details.\nThis function may throw in a future version of @pulumi/pulumi."
Can't work out how to unbundle this one. Thanks for any help!
p

polite-napkin-90098

08/01/2023, 2:58 PM
you need write it like
Copy code
pulumi.interpolate `redis://${redisCluster.cacheNodes.nodes[0].address}:6379`
I think
a

adorable-summer-21974

08/01/2023, 4:08 PM
Thanks for the quick reply! Unfortunately I get :
TSError: ⨯ Unable to compile TypeScript:
index.ts(217,56): error TS2345: Argument of type 'string' is not assignable to parameter of type 'TemplateStringsArray'.
index.ts(217,91): error TS2339: Property 'nodes' does not exist on type 'Output<ClusterCacheNode[]>'.
If I ask for element at index 0 of
cacheNodes
, then I get :
TSError: ⨯ Unable to compile TypeScript:
index.ts(217,56): error TS2345: Argument of type 'string' is not assignable to parameter of type 'TemplateStringsArray'.
Actually that seems to have worked on the second run 🤷‍♂️
Thanks!