terraform-aws-notify-slack module creates an SNS topic (or subscribes to an existing one) and an AWS Lambda function that forwards notifications to a Slack channel using Slack’s incoming webhooks API.
When an AWS service publishes a message to the SNS topic, the Lambda function (Python 3.13) parses the event payload, formats it into a Slack message, and sends it to the configured channel via your webhook URL.
Before you deploy this module, you need a Slack incoming webhook URL. Create one at my.slack.com/services/new/incoming-webhook and keep it secure — treat it like a password.
What the module creates
By default the module provisions:- An SNS topic with an optional KMS encryption key
- An AWS Lambda function (Python 3.13) subscribed to the topic
- The IAM role and policy the Lambda function needs to run and write CloudWatch logs
- A CloudWatch log group for Lambda execution logs
create_sns_topic = false.
Supported event types
The Lambda function recognises and formats the following AWS event types before sending them to Slack:CloudWatch Alarms
Metric alarms and LogMetrics alarms from Amazon CloudWatch.
GuardDuty Findings
Threat-intelligence findings produced by Amazon GuardDuty.
GuardDuty Malware Scan
Object scan results from GuardDuty Malware Protection.
Security Hub
Findings aggregated by AWS Security Hub.
AWS Health
Service health events and scheduled maintenance notices.
AWS Backup
Backup job status and vault notifications.
Generic messages
Any plain-text or JSON message published directly to the SNS topic.
Basic usage
Add the module block to your Terraform configuration and supply the four required variables:Key configuration options
| Variable | Required | Description |
|---|---|---|
sns_topic_name | Yes | Name for the SNS topic to create (or subscribe to). |
slack_webhook_url | Yes | Slack incoming webhook URL. |
slack_channel | Yes | Slack channel name that receives notifications. |
slack_username | Yes | Display name for the bot posting messages. |
create_sns_topic | No | Set to false to use an existing topic instead of creating one. |
kms_key_arn | No | KMS key ARN used to decrypt an encrypted webhook URL stored as a ciphertext. |
sns_topic_kms_key_id | No | KMS key ARN for server-side encryption of the SNS topic. |
lambda_function_vpc_subnet_ids | No | Deploy the Lambda function inside a VPC by providing subnet IDs. |
lambda_function_vpc_security_group_ids | No | Security groups to attach when the function runs inside a VPC. |