Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ministryofjustice/modernisation-platform-terraform-aws-chatbot
A Terraform module to create an AWS ChatBot Slack configuration. • This repository is defined and managed in Terraform
https://github.com/ministryofjustice/modernisation-platform-terraform-aws-chatbot
aws chatbot civil-service modernisation-platform slack terraform-module
Last synced: 29 days ago
JSON representation
A Terraform module to create an AWS ChatBot Slack configuration. • This repository is defined and managed in Terraform
- Host: GitHub
- URL: https://github.com/ministryofjustice/modernisation-platform-terraform-aws-chatbot
- Owner: ministryofjustice
- License: mit
- Created: 2024-07-16T09:51:51.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-26T08:37:11.000Z (about 1 month ago)
- Last Synced: 2024-09-27T18:42:43.886Z (about 1 month ago)
- Topics: aws, chatbot, civil-service, modernisation-platform, slack, terraform-module
- Language: HCL
- Homepage:
- Size: 185 KB
- Stars: 0
- Watchers: 84
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Modernisation Platform Terraform AWS ChatBot
[![Standards Icon]][Standards Link] [![Format Code Icon]][Format Code Link] [![Scorecards Icon]][Scorecards Link] [![SCA Icon]][SCA Link] [![Terraform SCA Icon]][Terraform SCA Link]
A Terraform module to create an AWS ChatBot Slack channel configuration. This module allows you to set up AWS ChatBot in your Slack channels and subscribe to your SNS topics as required.
This offers an alternative to receiving alerts via PagerDuty as described in the Mod Platform [documentation](https://user-guide.modernisation-platform.service.justice.gov.uk/user-guide/integrating-alarms-with-pagerduty-with-slack.html#integrating-cloudwatch-alarms-with-pagerduty-and-slack).
It can be used in conjunction with any existing SNS topics to receive alerts directly to Slack and there is no extra cost for using the service!
You might want to use this for non-critical type events that don't need to be raised via PagerDuty e.g. receiving AWS health events, billing alerts or upcoming certificate expiry etc.
## Initial Setup Required
**Please note** that you need to manually setup the Slack client for each AWS account you wish to use with AWS Chatbot by following these steps: https://docs.aws.amazon.com/chatbot/latest/adminguide/slack-setup.html#slack-client-setup
Once this has been actioned you can create as many Slack channel configurations as required using this module.
## Usage
```hcl
module "template" {
source = "github.com/ministryofjustice/modernisation-platform-terraform-aws-chatbot"
slack_channel_id = "XXXXXXXXXXX"
sns_topic_arns = ["arn:aws:sns:eu-west-2:${local.environment_management.account_ids[terraform.workspace]}:"]
tags = local.tags
application_name = local.application_name}
```
## Permissions
You can fine-tune the permissions available to AWS Chatbot so that you can control what users receiving the alerts in Slack can do (e.g. query log insights, raise support requests or even trigger lambda functions)
By default the module will assign the `arn:aws:iam::aws:policy/CloudWatchReadOnlyAccess` policy to the chatbot iam role. This ensures that users can see information in the alerts on slack for the various alarms that have been triggered etc. You can amend this by supplying an alternative value to the `managed_policy_arns` variable.
For more detail on policies you may typically want to assign to the role read https://docs.aws.amazon.com/chatbot/latest/adminguide/chatbot-iam-policies.htmlBy default this module will assign a Guardrail policy of `arn:aws:iam::aws:policy/ReadOnlyAccess`. This will constrain and take precedence over both user roles and channel roles. You can amend this by supplying an alternative value to the `guardrail_policies` variable.
For more detail read https://docs.aws.amazon.com/chatbot/latest/adminguide/understanding-permissions.html#channel-guardrails## Looking for issues?
If you're looking to raise an issue with this module, please create a new issue in the [Modernisation Platform repository](https://github.com/ministryofjustice/modernisation-platform/issues).## Requirements
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 1.0.1 |
| [aws](#requirement\_aws) | ~> 5.0 |
| [random](#requirement\_random) | ~> 3.0 |## Providers
| Name | Version |
|------|---------|
| [aws](#provider\_aws) | ~> 5.0 |
| [random](#provider\_random) | ~> 3.0 |## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [aws_chatbot_slack_channel_configuration.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/chatbot_slack_channel_configuration) | resource |
| [aws_iam_role.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [random_string.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) | resource |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [application\_name](#input\_application\_name) | Name of application | `string` | n/a | yes |
| [guardrail\_policies](#input\_guardrail\_policies) | A list of IAM policy ARNs that are applied as channel guardrails | `list(string)` |[| no |
"arn:aws:iam::aws:policy/ReadOnlyAccess"
]
| [managed\_policy\_arns](#input\_managed\_policy\_arns) | A list of policies arns to attach to the aws chatbot iam role as required | `list(string)` |[| no |
"arn:aws:iam::aws:policy/CloudWatchReadOnlyAccess"
]
| [slack\_channel\_id](#input\_slack\_channel\_id) | The Slack channel ID. Find the channel ID in Slack by right clicking on the channel in the channel list and copying the link. The channel ID is the string at the end of the URL. | `string` | n/a | yes |
| [slack\_team\_id](#input\_slack\_team\_id) | The Slack workspace ID. Defaults to Ministry of Justice Slack workspace | `string` | `"T02DYEB3A"` | no |
| [sns\_topic\_arns](#input\_sns\_topic\_arns) | ARNs of SNS topics which delivers notifications to AWS Chatbot, for example CloudWatch alarm notifications. | `list(string)` | n/a | yes |
| [tags](#input\_tags) | Common tags to be used by all resources | `map(string)` | n/a | yes |## Outputs
| Name | Description |
|------|-------------|
| [aws\_chatbot\_iam\_role](#output\_aws\_chatbot\_iam\_role) | n/a |
| [aws\_chatbot\_slack\_channel\_arn](#output\_aws\_chatbot\_slack\_channel\_arn) | n/a |
| [random\_suffix](#output\_random\_suffix) | n/a |[Standards Link]: https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-report/modernisation-platform-terraform-aws-chatbot "Repo standards badge."
[Standards Icon]: https://img.shields.io/endpoint?labelColor=231f20&color=005ea5&style=for-the-badge&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fendpoint%2Fmodernisation-platform&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABmJLR0QA/wD/AP+gvaeTAAAHJElEQV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3x/14PsUBn3NG51S0XpG0Z9PcOPKWSS0SKNUo9Rv2Mmt/G5WpPF6pHGra7Jv410OVsdaz217AbkAPX3ubkm240belCuudT4Rp5p/DyC2lf9mfq1iq5eFe8/lu+K0YrVp0uret4nAkwlB6vzjI/1PxrlrTp/oNHbzTJI92T1qAT+BfW49MhMg6JUp7ehY5a6Tl2jjmVvitF9fxo5Yq8CaAfAkzLMnySt6uz/1k6bPx59CpCNxGfoSKA30IPoH7cQXdArwCOllFX/i53P5P9a/gNkKpsCMFRuFAAAAABJRU5ErkJggg==
[Format Code Icon]: https://img.shields.io/github/actions/workflow/status/ministryofjustice/modernisation-platform-terraform-aws-chatbot/format-code.yml?labelColor=231f20&style=for-the-badge&label=Formate%20Code
[Format Code Link]: https://github.com/ministryofjustice/modernisation-platform-terraform-aws-chatbot/actions/workflows/format-code.yml
[Scorecards Icon]: https://img.shields.io/github/actions/workflow/status/ministryofjustice/modernisation-platform-terraform-aws-chatbot/scorecards.yml?branch=main&labelColor=231f20&style=for-the-badge&label=Scorecards
[Scorecards Link]: https://github.com/ministryofjustice/modernisation-platform-terraform-aws-chatbot/actions/workflows/scorecards.yml
[SCA Icon]: https://img.shields.io/github/actions/workflow/status/ministryofjustice/modernisation-platform-terraform-aws-chatbot/code-scanning.yml?branch=main&labelColor=231f20&style=for-the-badge&label=Secure%20Code%20Analysis
[SCA Link]: https://github.com/ministryofjustice/modernisation-platform-terraform-aws-chatbot/actions/workflows/code-scanning.yml
[Terraform SCA Icon]: https://img.shields.io/github/actions/workflow/status/ministryofjustice/modernisation-platform-terraform-aws-chatbot/code-scanning.yml?branch=main&labelColor=231f20&style=for-the-badge&label=Terraform%20Static%20Code%20Analysis
[Terraform SCA Link]: https://github.com/ministryofjustice/modernisation-platform-terraform-aws-chatbot/actions/workflows/terraform-static-analysis.yml