Skip to content
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

Ability to create multiple SNS topics, each to a different slack channel #38

Open
wesleung opened this issue Jan 24, 2023 · 0 comments
Open

Comments

@wesleung
Copy link

Have a question? Please checkout our Slack Community or visit our Slack Archive.

Slack Community

Describe the Feature

Ability to define multiple SNS topics, each sending to different slack channels. Problem when I do this with the current implementation on the second pass of the loop we get a log group duplicate error:

│ Error: creating CloudWatch Logs Log Group (/aws/lambda/XXX-YYYYYY-default): ResourceAlreadyExistsException: The specified log group already exists

│ with module.notify_slack["b"].module.notify_slack.aws_cloudwatch_log_group.lambda[0],
│ on .terraform/modules/notify_slack.notify_slack/main.tf line 46, in resource "aws_cloudwatch_log_group" "lambda":
│ 46: resource "aws_cloudwatch_log_group" "lambda" {

Expected Behavior

List or Map of SNS topic to slack channels in a for_each loop to work properly

Use Case

SNS Topics:

  • "slack-a" sns topic sends to slack channel "#a"
  • "slack-b" sns topic sends to slack channel "#b"

Describe Ideal Solution

A clear and concise description of what you want to happen. If you don't know, that's okay.
`
variable "slack_channel" {
description = "List of slack channels"
type = list
default = ["a", "b"]
}

module "notify_slack" {
for_each = toset(var.slack_channel)
source = "git::https://github.com/cloudposse/terraform-aws-sns-lambda-notify-slack?ref=tags/0.5.9"
namespace = var.account_name
name = "slack-${each.key}"
slack_channel = each.key
slack_webhook_url = var.slack_webhook_url
slack_username = var.slack_username
`

Alternatives Considered

Additional Context

This issue looks to be a problem with the underlying terraform-aws-modules/notify-slack/aws module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant