https://github.com/jameswoolfenden/terraform-aws-lambdaslack
This is a general AWS to slack notifier, it owes much to https://github.com/arabold/aws-to-slack, but has been enhanced to work with Terraform
https://github.com/jameswoolfenden/terraform-aws-lambdaslack
aws module terraform
Last synced: about 1 year ago
JSON representation
This is a general AWS to slack notifier, it owes much to https://github.com/arabold/aws-to-slack, but has been enhanced to work with Terraform
- Host: GitHub
- URL: https://github.com/jameswoolfenden/terraform-aws-lambdaslack
- Owner: JamesWoolfenden
- License: apache-2.0
- Created: 2019-05-13T10:45:14.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-07T09:25:52.000Z (almost 2 years ago)
- Last Synced: 2025-04-19T10:08:35.300Z (about 1 year ago)
- Topics: aws, module, terraform
- Language: JavaScript
- Homepage:
- Size: 169 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
terraform-aws-lambdaslack
[](https://github.com/jameswoolfenden/terraform-aws-lambdaslack)
[](https://github.com/jameswoolfenden/terraform-aws-lambdaslack/releases/latest)
[](https://github.com/JamesWoolfenden/terraform-aws-lambdaslack/releases/latest)

[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-lambdaslack&benchmark=CIS+AWS+V1.2)
[](https://github.com/pre-commit/pre-commit)
[](https://www.checkov.io/)
[](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=JamesWoolfenden%2Fterraform-aws-lambdaslack&benchmark=INFRASTRUCTURE+SECURITY)
Terraform module to provision an Lambda based integration to Slack, it can take any number of different lambda triggers and convert them into slack messages. It is modified version of the Cloud formation of https://github.com/arabold/aws-to-slack.
---
This project is 100% Open Source and licensed under the [APACHE2](LICENSE).
## Usage
Include this repository as a module in your existing terraform code:
```hcl
module "lambdaslack" {
source = "github.com/jameswoolfenden/terraform-aws-lambdaslack"
arns = var.arns
common_tags = var.common_tags
rules = var.rules
SLACK_CHANNEL = var.SLACK_CHANNEL
SLACK_HOOK_URL = var.SLACK_HOOK_URL
}
```
## Requirements
No requirements.
## Providers
| Name | Version |
|------|---------|
| [archive](#provider\_archive) | n/a |
| [aws](#provider\_aws) | n/a |
| [null](#provider\_null) | n/a |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_cloudwatch_event_target.snstoslack](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_event_target) | resource |
| [aws_iam_role.awstoslack](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy_attachment.AWSLambdaBasicExecutionRole](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_iam_role_policy_attachment.CloudWatchReadOnlyAccess](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
| [aws_lambda_function.awstoslack](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
| [aws_lambda_permission.EventsToLambda](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
| [aws_lambda_permission.SNSToLambda](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
| [aws_sns_topic_subscription.snstoslack](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |
| [null_resource.node_modules](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [archive_file.lambda](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
| [aws_iam_policy_document.assumerole](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [SLACK\_CHANNEL](#input\_SLACK\_CHANNEL) | Name of the SLACK Channel | `string` | n/a | yes |
| [SLACK\_HOOK\_URL](#input\_SLACK\_HOOK\_URL) | The Slack Webhook URL | `string` | n/a | yes |
| [arns](#input\_arns) | n/a | `list(any)` | n/a | yes |
| [common\_tags](#input\_common\_tags) | This is to help you add tags to your cloud objects | `map(any)` | n/a | yes |
| [function\_name](#input\_function\_name) | The name of the lambda function | `string` | `"aws-to-slack-Handler"` | no |
| [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of your CMK | `any` | n/a | yes |
| [memory\_size](#input\_memory\_size) | lambda ram | `number` | `256` | no |
| [protocol](#input\_protocol) | SNS Subscription Protocol | `string` | `"lambda"` | no |
| [role\_name](#input\_role\_name) | The name of the IAM role | `string` | `"aws-to-slack-HandlerRole"` | no |
| [rules](#input\_rules) | n/a | `list(any)` | n/a | yes |
| [runtime](#input\_runtime) | n/a | `string` | `"nodejs6.10"` | no |
| [timeout](#input\_timeout) | lambda timeout | `number` | `10` | no |
## Outputs
No outputs.
## Policy
This is the policy required to build this project:
The Terraform resource required is:
```golang
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DescribeAccountAttributes"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"events:ListTargetsByRule",
"events:PutTargets",
"events:RemoveTargets"
],
"Resource": "*"
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": [
"iam:AttachRolePolicy",
"iam:CreateRole",
"iam:DeleteRole",
"iam:DetachRolePolicy",
"iam:GetRole",
"iam:ListAttachedRolePolicies",
"iam:ListInstanceProfilesForRole",
"iam:ListRolePolicies",
"iam:PassRole"
],
"Resource": "*"
},
{
"Sid": "VisualEditor3",
"Effect": "Allow",
"Action": [
"lambda:AddPermission",
"lambda:CreateFunction",
"lambda:DeleteFunction",
"lambda:GetFunction",
"lambda:GetFunctionCodeSigningConfig",
"lambda:GetPolicy",
"lambda:ListVersionsByFunction",
"lambda:RemovePermission",
"lambda:TagResource",
"lambda:UntagResource"
],
"Resource": "*"
}
]
})
}
```
## Related Projects
Check out these related projects.
- [Cloudformation lambda for slack](https://github.com/arabold/aws-to-slack) - Forward AWS CloudWatch Alarms and other notifications from Amazon SNS to Slack."
## Help
**Got a question?**
File a GitHub [issue](https://github.com/jameswoolfenden/terraform-aws-lambdaslack/issues).
## Contributing
### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/jameswoolfenden/terraform-aws-lambdaslack/issues) to report any bugs or file feature requests.
## Copyrights
Copyright © 2019-2022 James Woolfenden
## License
[](https://opensource.org/licenses/Apache-2.0)
See [LICENSE](LICENSE) for full details.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
### Contributors
[![James Woolfenden][jameswoolfenden_avatar]][jameswoolfenden_homepage]
[James Woolfenden][jameswoolfenden_homepage]
[jameswoolfenden_homepage]: https://github.com/jameswoolfenden
[jameswoolfenden_avatar]: https://github.com/jameswoolfenden.png?size=150