Design question: I have a microservice:tm: that wi...
# general
Design question: I have a microservice™️ that will handle SNS topics, for instance posting a message the topic
will send a HTTP call to Now, I need Pulumi to subscribe to that topic once that service is deployed, something like
Copy code
new aws.sns.TopicSubscription(
      topic: 'arn:aws:sns:us-east-1:1234:foo',
      endpoint: `${myServiceEndpoint}/foo-sns-handler`,
      protocol: 'https',
I would like to avoid having to define the SNS topic in my service and in Pulumi, ideally there would be a single place where the "topic -> handler" relation is defined. Does that make sense? Any ideas? -- In other words, I'm looking for a way to have a service declare the resources it needs, and have pulumi handle those resources during deployment (doesn't have to be an SNS topic, could be S3 buckets or any other pulumi resources)
Can you declare the TopicSubscription with Pulumi, and pass the ARN to the microservice as an environment variable? Or are you saying you need your microservice to dynamically subscribe to topics?
That would work somewhat, but then you don't have any guarantee that your service is able to handle that subscription (like if for instance you revert to an older version)
Maybe my service can export a ComponentResource that I can import from my "main" pulumi, 🤔
You could export the topic ARN and use StackReference to get the Output value.
👀 1
Or you can tag your topic, and use the AWS SDK to look-up the topic by tag