Notify CodePipeline status changes such as STARTED, SUCCEEDED, FAILED, and so on to a Slack channel.
The repository includes a lambda function and a Terraform module, so it's easy to set up in your environment.
- Terraform 0.12
- Docker
- Build the Lambda function
- Set up a Slack webhook URL to SSM parameter store
- Update your AWS environment with Terraform
The following command builds the Lambda function in a Docker environment.
docker run --rm -v ${PWD}:/code -v \
${HOME}/.cargo/registry:/root/.cargo/registry -v \
${HOME}/.cargo/git:/root/.cargo/git softprops/lambda-rust
The zipped Lambda function will be at ./target/lambda/release/codepipeline-slack.zip
.
The Lambda function looks for a Slack's webhook URL from SSM parameter store. The parameter name can be configured by a Terraform variable.
- name
- /codepipeline-slack/webhook-url-ssm-param
- value (SecureString is recommended)
- https:....
First, copy terraform
directory to your Terraform directory. And then add a module block to your Terraform configuration file:
module "codepipeline-slack" {
source = "../modules/codepipeline-slack"
slack_webhook_url_ssm_parameter = "/codepipeline-slack/webhook-url-ssm-param"
lambda_zip_file = "lambda/codepipeline-slack.zip"
}
- slack_webhook_url_ssm_parameter
- The SSM parameter name which is configured in the previous section
- lambda_zip_file
- Path to the Lambda zip file
Now you can apply the configuration by terraform apply
.