https://pulumi.com logo
#typescript
Title
# typescript
c

creamy-traffic-12121

03/30/2020, 4:13 PM
@here running into some issues when trying to reference an arn when creating an sns topic (typescript project):
Copy code
const topicSubscription = new aws.sns.TopicSubscription("topic", {
    topic: snsTopic,
    protocol: "lambda",
    endpoint: lambda.arn
})
This is throwing the following error when running `$ pulumi up`:
Copy code
error: Running program '/Users/michaelstott/sns' failed with an unhandled exception:
    TypeError: Cannot read property 'arn' of undefined
        at Object.<anonymous> (/Users/michaelstott/sns/sns.ts:10:25)
        at Module._compile (internal/modules/cjs/loader.js:955:30)
The lambda in question is defined in another file and would be provisioned normally if not for this error. It seems that Pulumi is attempting to create the topic before the lambda is created. Is there a workaround for this?
m

miniature-musician-31262

03/30/2020, 5:01 PM
Any chance you could post a bit more code showing how you’re instantiating, exporting and importing the reference to
lambda
?.
c

creamy-traffic-12121

03/30/2020, 5:23 PM
It's part of a larger project, but I'll try to post a poc soon.
3 Views