pulumi / pulumi-aws

An Amazon Web Services (AWS) Pulumi resource package, providing multi-language access to AWS
Apache License 2.0
460 stars 155 forks source link

AWS SNS and SQS Topics Subscriptions are not being correctly configured. #3485

Open zestsystem opened 8 months ago

zestsystem commented 8 months ago

What happened?

Deploy AWS SNS and SQS with pulumi up always results in subscription not working. At the moment, I find myself going to the SQS dashboard and manually subscribing to SNS topic to have SQS recieve message from SNS. Essentially, aws.sns.TopicSubscription does nothing. The subscription itself is created ( I can see it on the dashboard), but it does not work (messages are not received by the queue).

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const testQueueEventsTopic = new aws.sns.Topic("testQueueEventsTopic", {});
export const testQueueEventsTopicArn = testQueueEventsTopic.arn;

const sqsTestQueue = new aws.sqs.Queue("testQueue", {});
export const sqsTestUrl = sqsTestQueue.url;
const testQueueSubscription = new aws.sns.TopicSubscription(
  "testQueueSubscription",
  {
    topic: testQueueEventsTopic.arn,
    protocol: "sqs",
    endpoint: sqsTestQueue.arn,
    rawMessageDelivery: true,
    filterPolicyScope: "MessageBody",
    filterPolicy: JSON.stringify({
      event: ["test-queue"],
    }),
  },
);

Example

Repro repo:

https://github.com/zestsystem/pulumi-sns-sqs-sub-bug

Output of pulumi about

warning: using pulumi-language-nodejs from $PATH at /nix/store/yk19rks3lispdvq6s442sf15ljq74rzw-pulumi-language-nodejs-3.93.0/bin/pulumi-language-nodejs warning: using pulumi-language-nodejs from $PATH at /nix/store/yk19rks3lispdvq6s442sf15ljq74rzw-pulumi-language-nodejs-3.93.0/bin/pulumi-language-nodejs CLI
Version 3.93.0 Go Version go1.21.7 Go Compiler gc

Plugins NAME VERSION aws 6.23.0 aws 6.0.0 nodejs unknown

Host
OS darwin Version 13.5 Arch arm64

This project is written in nodejs: executable='/nix/store/fxly5x870ssyw5rbvdi58jbhc4j03mzk-nodejs-18.19.1/bin/node' version='v18.19.1'

Current Stack: utc/test-sns-sqs/dev

TYPE URN pulumi:pulumi:Stack urn:pulumi:dev::test-sns-sqs::pulumi:pulumi:Stack::test-sns-sqs-dev pulumi:providers:aws urn:pulumi:dev::test-sns-sqs::pulumi:providers:aws::default_6_23_0 aws:sns/topic:Topic urn:pulumi:dev::test-sns-sqs::aws:sns/topic:Topic::testQueueEventsTopic aws:sqs/queue:Queue urn:pulumi:dev::test-sns-sqs::aws:sqs/queue:Queue::testQueue aws:sns/topicSubscription:TopicSubscription urn:pulumi:dev::test-sns-sqs::aws:sns/topicSubscription:TopicSubscription::testQueueSubscription

Found no pending operations associated with dev

Backend
Name pulumi.com URL https://app.pulumi.com/zestsystem User zestsystem Organizations zestsystem, utc Token type personal

Dependencies: NAME VERSION @pulumi/aws 6.23.0 @pulumi/pulumi 3.107.0 @types/node 18.19.18

Pulumi locates its logs in /var/folders/pf/34pz6n095dz0b0q2ph6xst_c0000gn/T/ by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

iwahbe commented 8 months ago

Hi @zestsystem. I'm sorry this isn't working for you. I appreciate the clean repro.