-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-chatbot: ISlackChannelConfiguration should include addNotificationTopic() method #21171
Comments
This sounds reasonable @polastre! Are you interested in contributing this? |
@kaizencc I tried working on this but I'm not sure how to properly test this. Do you have an idea/hint how to do it? |
I implemented this change, but when unit testing realized that adding an SNS topic to a Slack Config retrieved by ARN from another stack doesn't actually seem to add it to the existing Slack Config. Does it go against best practices to modify one stack from another like this, and if not, is there an established way to trigger the changes to Cloudformation after calling the method to add SNS topics? Thanks. |
I also had the same thing @debnon, when I added the method and tried to use it, it created the sns topics, but they weren't in slack channel topics. can anyone show an example similar to this so we can just add it? |
Is there any workaround to use shared stack which creates slack notifications and attach the new SNS topics inside? |
@larskinder Also it doesn't show in the documentation: |
Sry, re-added my previous post, that you were referencing to. This is how you can add SNS topics to an existing Slack config.
|
@ben-buitendijk what version of cdk are you using? |
That is the page when you create a new SlackChannelConfiguration, but the construct when you import it from an ARN doesn't have that method |
Need this for the interface. |
no response? this shouldn't be that hard I feel like 😁 |
This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue. |
Bump |
I think this is already implemented by now but now i am wondering if there is a way to obtain the SlackChannelConfiguration topics? so somehow get the list of subscribed topics for a given SlackChannelConfiguration using CDK or CLI! EDIT: typo |
@luiscastillocr I don't think it's been added, look at the last commits. https://github.com/aws/aws-cdk/commits/26dcc1e11a07d93681145049aa06d80a7d2114b9/packages/aws-cdk-lib/aws-chatbot/lib/slack-channel-configuration.ts not sure even if it's possible, the resource is created, we'd be wanting to manipulate the resource we created in one stack in another stack. an alternative to this would be to do Alarms -> SNS -> Lambda (provide your webhook url & stuff, write your custom message) -> Slack |
hey @sercantor you are right, i was looking at the
then i can do something like this in a CodeBuildStep command
😉 |
well looks like I am going to need this method after all, happen that there are co-workers that have their slack channel pre-configured in their sanboxes so if someone have it pointing to the same slack channel ID, the SlackChannelConfiguration will throw an error saying the channel is already configured.
@larskinder I don't think this is possible in NodeJS since you have to mandatory pass the |
Hey, sorry for not getting back to you sooner. About your last question, I only tried it back in the day with Python, sadly never with TS. :( |
+1 |
Same issue here. |
After team discussion, we are not able to support this feature.
If this resource is created/managed using CloudFormation, this will cause CloudFormation stack drift, which should be avoided. If this resource is not managed by CloudFormation, it's impossible to modify the property. In CDK, resources referenced via |
I guess as a workaround one could instead import a topic connected to the slack channel configuration with |
|
1 similar comment
|
I understand not wanting to support the addNotificationTopic in some ways, but if that is the case I feel like we should not be locking down the new slack channel configuration to a channel only being allowed to be used once. |
Describe the feature
#15588 and #16643 added the method
addNotificationTopic()
to theSlackChannelConfiguration
construct. This allows the SNS topic to be added to an existing configuration.For an existing slack channel, it can be imported with
SlackChannelConfiguration. fromSlackChannelConfigurationArn
. This returnsSlackChannelConfiguration
.If you create a new
SlackChannelConfiguration
construct, then you can useaddNotificationTopic
since it returns that construct object. If you usefromSlackChannelConfigurationArn
, then you getISlackChannelConfiguration
which does not haveaddNotificationTopic
.The request to is add
addNotificationTopic
toISlackChannelConfiguration
so that it can used with existing slack channel configurations.Use Case
A stack where the slack channel configuration is already defined, and the stack seeks to add notification topics to that existing slack channel configuration.
Proposed Solution
Add
addNotificationTopic
to the interface in https://github.com/xykkong/aws-cdk/blob/master/packages/@aws-cdk/aws-chatbot/lib/slack-channel-configuration.ts#L109Other Information
No response
Acknowledgements
CDK version used
2.32.0
Environment details (OS name and version, etc.)
typescript
The text was updated successfully, but these errors were encountered: