All Projects → terraform-aws-modules → Terraform Aws Notify Slack

terraform-aws-modules / Terraform Aws Notify Slack

Licence: other
Terraform module which creates SNS topic and Lambda function which sends notifications to Slack

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Terraform Aws Notify Slack

Aws To Slack
Forward AWS CloudWatch Alarms and other notifications from Amazon SNS to Slack.
Stars: ✭ 261 (-10%)
Mutual labels:  aws, aws-lambda, slack
Aws Maintenance Lambda
A lambda function to send alerts (to Slack, HipChat) on AWS maintenance events.
Stars: ✭ 133 (-54.14%)
Mutual labels:  aws, aws-lambda, slack
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (-21.38%)
Mutual labels:  aws, aws-lambda
Nuxt Serverless
Nuxt.js Serverless SSR Starter on AWS (Lambda + API Gateway + S3) with Serverless Framework
Stars: ✭ 235 (-18.97%)
Mutual labels:  aws, aws-lambda
aws-iam-slack-notifer
Notifies slack when an IAM policy is created, changed or assigned to a role
Stars: ✭ 35 (-87.93%)
Mutual labels:  slack, aws-lambda
Serverless Plugin Canary Deployments
Canary deployments for your Serverless application
Stars: ✭ 283 (-2.41%)
Mutual labels:  aws, aws-lambda
Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+805.17%)
Mutual labels:  aws, aws-lambda
Hodor
Hodor is a an automation application that is used to open the door controlled by an intercom system from Slack using a custom slash command.
Stars: ✭ 21 (-92.76%)
Mutual labels:  slack, aws-lambda
Serverless Slack App
A Serverless.js Slack App Boilerplate with OAuth and Bot actions
Stars: ✭ 217 (-25.17%)
Mutual labels:  aws, slack
Laconia
Create well-crafted serverless applications, effortlessly
Stars: ✭ 260 (-10.34%)
Mutual labels:  aws, aws-lambda
Serverless Architecture Boilerplate
📦 ⚡️ 🚀 Boilerplate to organize and deploy big projects using AWS API Gateway and AWS Lambda with Serverless Framework
Stars: ✭ 269 (-7.24%)
Mutual labels:  aws, aws-lambda
Aws Lambda Cheatsheet
AWS Lambda cheatsheet.
Stars: ✭ 227 (-21.72%)
Mutual labels:  aws, aws-lambda
Aws Lambda Haskell Runtime
⚡Haskell runtime for AWS Lambda
Stars: ✭ 223 (-23.1%)
Mutual labels:  aws, aws-lambda
Algnhsa
AWS Lambda Go net/http server adapter
Stars: ✭ 226 (-22.07%)
Mutual labels:  aws, aws-lambda
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (-25.52%)
Mutual labels:  aws, aws-lambda
Aws Toolkit Eclipse
AWS Toolkit for Eclipse – an open-source plugin for developing, deploying, and managing AWS applications.
Stars: ✭ 252 (-13.1%)
Mutual labels:  aws, aws-lambda
Aws Auto Cleanup
Open-source application to programmatically clean your AWS resources based on a whitelist and time to live (TTL) settings
Stars: ✭ 276 (-4.83%)
Mutual labels:  aws, aws-lambda
Chrome Aws Lambda Layer
43 MB Google Chrome to fit inside AWS Lambda Layer compressed with Brotli
Stars: ✭ 212 (-26.9%)
Mutual labels:  aws, aws-lambda
Hal
hal provides an AWS Lambda Custom Runtime environment for your Haskell applications.
Stars: ✭ 213 (-26.55%)
Mutual labels:  aws, aws-lambda
Serverlessbydesign
A visual approach to serverless development. Think. Build. Repeat.
Stars: ✭ 254 (-12.41%)
Mutual labels:  aws, aws-lambda

AWS Notify Slack Terraform module

This module creates an SNS topic (or uses an existing one) and an AWS Lambda function that sends notifications to Slack using the incoming webhooks API.

Start by setting up an incoming webhook integration in your Slack workspace.

Doing serverless with Terraform? Check out serverless.tf framework, which aims to simplify all operations when working with the serverless in Terraform.

Terraform versions

Terraform 0.13. Pin module version to ~> v4.0. Submit pull-requests to master branch.

Terraform 0.12. Pin module version to 3.5.0 (or older). Submit pull-requests to terraform012 branch.

Terraform 0.11. Pin module version to ~> v1.0.

Features

  • [x] AWS Lambda runtime Python 3.8
  • [x] Create new SNS topic or use existing one
  • [x] Support plaintext and encrypted version of Slack webhook URL
  • [x] Most of Slack message options are customizable
  • [x] Support different types of SNS messages:
  • [x] Local pytest driven testing of the lambda to a Slack sandbox channel

Usage

module "notify_slack" {
  source  = "terraform-aws-modules/notify-slack/aws"
  version = "~> 4.0"

  sns_topic_name = "slack-topic"

  slack_webhook_url = "https://hooks.slack.com/services/AAA/BBB/CCC"
  slack_channel     = "aws-notification"
  slack_username    = "reporter"
}

Upgrade from 2.0 to 3.0

Version 3 uses Terraform AWS Lambda module to handle most of heavy-lifting related to Lambda packaging, roles, and permissions, while maintaining the same interface for the user of this module after many of resources will be recreated.

Using with Terraform Cloud Agents

Terraform Cloud Agents are a paid feature, available as part of the Terraform Cloud for Business upgrade package.

This module requires Python 3.8. You can customize tfc-agent to include Python using this sample Dockerfile:

FROM hashicorp/tfc-agent:latest
RUN apt-get -y update && apt-get -y install python3.8 python3-pip
ENTRYPOINT ["/bin/tfc-agent"]

Use existing SNS topic or create new

If you want to subscribe the AWS Lambda Function created by this module to an existing SNS topic you should specify create_sns_topic = false as an argument and specify the name of existing SNS topic name in sns_topic_name.

Examples

  • notify-slack-simple - Creates SNS topic which sends messages to Slack channel.
  • cloudwatch-alerts-to-slack - End to end example which shows how to send AWS Cloudwatch alerts to Slack channel and use KMS to encrypt webhook URL.

Testing with pytest

To run the tests:

  1. Set up a dedicated slack channel as a test sandbox with it's own webhook. See Slack Incoming Webhooks docs for details.

  2. Make a copy of the sample pytest configuration and edit as needed.

     cp functions/pytest.ini.sample functions/pytest.ini
    
  3. Run the tests:

     pytest functions/notify_slack_test.py
    

Requirements

Name Version
terraform >= 0.13.0
aws >= 2.35

Providers

Name Version
aws >= 2.35

Modules

Name Source Version
lambda terraform-aws-modules/lambda/aws 1.28.0

Resources

Name
aws_caller_identity
aws_cloudwatch_log_group
aws_iam_policy_document
aws_partition
aws_region
aws_sns_topic
aws_sns_topic_subscription

Inputs

Name Description Type Default Required
cloudwatch_log_group_kms_key_id The ARN of the KMS Key to use when encrypting log data for Lambda string null no
cloudwatch_log_group_retention_in_days Specifies the number of days you want to retain log events in log group for Lambda. number 0 no
cloudwatch_log_group_tags Additional tags for the Cloudwatch log group map(string) {} no
create Whether to create all resources bool true no
create_sns_topic Whether to create new SNS topic bool true no
iam_role_boundary_policy_arn The ARN of the policy that is used to set the permissions boundary for the role string null no
iam_role_name_prefix A unique role name beginning with the specified prefix string "lambda" no
iam_role_tags Additional tags for the IAM role map(string) {} no
kms_key_arn ARN of the KMS key used for decrypting slack webhook url string "" no
lambda_description The description of the Lambda function string null no
lambda_function_name The name of the Lambda function to create string "notify_slack" no
lambda_function_s3_bucket S3 bucket to store artifacts string null no
lambda_function_store_on_s3 Whether to store produced artifacts on S3 or locally. bool false no
lambda_function_tags Additional tags for the Lambda function map(string) {} no
lambda_function_vpc_security_group_ids List of security group ids when Lambda Function should run in the VPC. list(string) null no
lambda_function_vpc_subnet_ids List of subnet ids when Lambda Function should run in the VPC. Usually private or intra subnets. list(string) null no
lambda_role IAM role attached to the Lambda Function. If this is set then a role will not be created for you. string "" no
log_events Boolean flag to enabled/disable logging of incoming events bool false no
reserved_concurrent_executions The amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations number -1 no
slack_channel The name of the channel in Slack for notifications string n/a yes
slack_emoji A custom emoji that will appear on Slack messages string ":aws:" no
slack_username The username that will appear on Slack messages string n/a yes
slack_webhook_url The URL of Slack webhook string n/a yes
sns_topic_kms_key_id ARN of the KMS key used for enabling SSE on the topic string "" no
sns_topic_name The name of the SNS topic to create string n/a yes
sns_topic_tags Additional tags for the SNS topic map(string) {} no
subscription_filter_policy (Optional) A valid filter policy that will be used in the subscription to filter messages seen by the target resource. string null no
tags A map of tags to add to all resources map(string) {} no

Outputs

Name Description
lambda_cloudwatch_log_group_arn The Amazon Resource Name (ARN) specifying the log group
lambda_iam_role_arn The ARN of the IAM role used by Lambda function
lambda_iam_role_name The name of the IAM role used by Lambda function
notify_slack_lambda_function_arn The ARN of the Lambda function
notify_slack_lambda_function_invoke_arn The ARN to be used for invoking Lambda function from API Gateway
notify_slack_lambda_function_last_modified The date Lambda function was last modified
notify_slack_lambda_function_name The name of the Lambda function
notify_slack_lambda_function_version Latest published version of your Lambda function
this_slack_topic_arn The ARN of the SNS topic from which messages will be sent to Slack

Authors

Module managed by Anton Babenko.

License

Apache 2 Licensed. See LICENSE for full details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].