Skip to content

Latest commit

 

History

History
100 lines (68 loc) · 4.02 KB

README.md

File metadata and controls

100 lines (68 loc) · 4.02 KB

AWS Codepipeline notification for Discord

A discord notification triggered by codepipeline, using SNS and AWS Lambda.

Requirements

How to get Discord token and webhook

Follow this tutorial to get Discord Token: link

Follow this tutorial to get Discord Webhook url: link

How to use this module

Clone this repo

git clone https://github.com/chnacib/discord-codepipeline.git
cd discord-codepipeline/module

Edit terrafile.tf and replace variables in module

module "lambda_sns" {
  source        = "../"
  region        = "us-east-1"
  account_id    = "01234567890"
  token         = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  url           = "https://discord.com/api/v9/channels/xxxxxxxxxxxx/messages"
  function_name = "sample-function"
  topic_name = "sample-topic"  
}

Deploy terraform module

terraform init

terraform apply -auto-approve

Create Codepipeline notification rule

click on "Create notification rule"

image

This application only supports some events, so mark the checkbox as this example

image

Choose a sns topic target

image

Providers

Name Version
aws n/a

Modules

Name Source Version
lambda_sns ../ n/a

Resources

Name Type
aws_iam_role.iam_for_lambda resource
aws_iam_role_policy_attachment.basic resource
aws_lambda_function.main resource
aws_lambda_layer_version.lambda_layer resource
aws_lambda_permission.with_sns resource
aws_sns_topic.topic resource
aws_sns_topic_policy.topic_policy resource
aws_sns_topic_subscription.user_updates_sqs_target resource

Inputs

Name Description Type Default Required
account_id AWS Account ID string n/a yes
function_name AWS Lambda function name string n/a yes
region AWS region string n/a yes
token Discord account token string n/a yes
topic_name SNS Topic name string n/a yes
url Discord Webhook URL string n/a yes

Checking your discord channel :)

image