mapbox / magic-cfn-resources

Build Lambda-backed custom CloudFormation resources ✨
4 stars 5 forks source link

remove SnsSubscriptions from oldTopic #42

Open mapsam opened 2 years ago

mapsam commented 2 years ago

The SnsSubscription function manages to remove old subscriptions in the current topic when searching for subscriptions here but it does not remove subscriptions if the topic has changed in a stack update.

For example:

  1. stack update subscribes Endpoint1 to TopicA
  2. then stack is updated to subscribe Endpoint1 to TopicB instead of TopicA

The delete method does not search TopicA for subscriptions to remove, only TopicB to avoid duplicate subscriptions. This means Endpoint1 will continue to receive messages from TopicA until it the subscription is manually deleted by an engineer.

We should update the lambda function to search for subscriptions in the oldTopic and newTopic.

mapsam commented 2 years ago

cc @Benyuel @bilindhajer @hwrdwlf