sparse-intern-71089
11/25/2018, 6:52 PMbig-piano-35669
aws.sqs.getQueue
function returns a Promise<GetQueueResult>
(https://github.com/pulumi/pulumi-aws/blob/cfcf3ed0c7019484ffc2a62de4498e41d802ee71/sdk/nodejs/sqs/getQueue.ts#L12). In JavaScript, you would need to somehow rendezvous with the promise's result, as it is produced asynchronously, either using the new await
syntax if you're on a newer Node.js or TypeScript (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-7.html), or use the then
function to retrieve it (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then). For instance
exports.QueueArn = theQueue.then(q => q.arn);
Note here that QueueArn
will itself be a promise.
An alternative way to accomplish this same thing is to use the static function aws.sqs.Queue.get
, in which case the code you wrote will work almost exactly as-is:
const theQueue = aws.sqs.Queue.get("the-queue");
exports.QueueArn = theQueue.arn;
It's unfortunate there are two ways to do this same thing, however in many cases the functions offer slightly different functionality -- in this case, they are virtually identical.eager-area-86739
11/26/2018, 8:48 AMthen
I was trying to return the object! Cheers