This module creates a Lambda function posts messages to a Slack channel when a CloudWatch alarm changes state.
- Create a Slack App with an incoming webhook for the channel you'd like to post in.
- Create one or more SNS Topics and subscribe them to this module's Lambda ARN output.
- Setup CloudWatch Alarms that send their state changes to the SNS Topics.
The above is shown in the full setup example.
The Python code that posts the message to Slack was adopted from the terraform-aws-notify-slack module under the Apache 2.0 license.
No requirements.
Name | Version |
---|---|
archive | n/a |
aws | n/a |
No modules.
Name | Type |
---|---|
aws_cloudwatch_log_group.notify_slack_lambda | resource |
aws_iam_policy.notify_slack_lambda | resource |
aws_iam_role.notify_slack_lambda | resource |
aws_iam_role_policy_attachment.notify_slack_lambda | resource |
aws_lambda_function.notify_slack | resource |
aws_lambda_permission.notify_slack | resource |
archive_file.notify_slack | data source |
aws_iam_policy_document.lambda_assume_policy | data source |
aws_iam_policy_document.notify_slack_lambda | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
billing_tag_key | (Optional, default 'CostCentre') Name of the billing tag. | string |
"CostCentre" |
no |
billing_tag_value | (Required) Value of the billing tag. | string |
n/a | yes |
function_name | (Required) Name of the Lambda function. | string |
n/a | yes |
project_name | (Required) Name of the project. This is added to the Slack message's title. | string |
n/a | yes |
slack_webhook_url | (Required) Slack incoming webhook URL. This determines where the Slack message is posted. | string |
n/a | yes |
sns_topic_arns | (Required) SNS topic ARNs that will invoke the Lambda function and cause a Slack message to be posted. | list(string) |
n/a | yes |
Name | Description |
---|---|
lambda_arn | ARN of the Lambda function that creates the Slack message |