Pavan Kumar
08/15/2021, 4:26 AMconst rabbitMQ = new CfnBroker(this, "name', {...});
I want to get connection string out of created rabbitMQ. So I used following code.
environment {
RABBIT: rabbitMQ.attrAmqpEndpoints[0]
}
Even thought attrAmpqEndpoints
is documented as string[]
sst run stat
was throwing error saying I can access array using index directly and I can access it using Fn.select(index, list).
So I changed code to
import { Fn } from '@aws-cdk/core';
...
environment {
RABBIT: Fn.select(0, rabbitMQ.attrAmqpEndpoints)
}
Above code worked, but, I don't understand why there is need to use Fn
for accessing array element at index. While at typescript should be able to use list[0]
right?Simon Reilly
08/15/2021, 8:29 AMPavan Kumar
08/15/2021, 10:37 AMthis.addOutputs({
queUrl: aQueue.sqsQueue.queueUrl,
rabitEndpoint: Fn.select(0, rabbitMQ.attrAmqpEndpoints),
});
I assume even the queue URL is not available until runtime, but it could used directly like aQueue.sqsQueue.queueUrl
but rabbitMQ array needs Fn
. I am puzzled with this disparity.Simon Reilly
08/15/2021, 11:26 AMFrank
Frank
Frank
Frank
Frank
Frank
Pavan Kumar
08/16/2021, 11:28 AM