A Terraform module that creates AWS Budgets and, the AWS Chatbot integration allows you to receive the alerts in your designated Slack channel.
In order to configure the integration between AWS Chatbot and Slack, this module requires the variables slack_workspace_id
and slack_channel_id
.
Slack Workspace ID: Perform the initial authorization flow with Slack in the AWS Chatbot console. For more details, refer to Setting Up AWS Chatbot with Slack in the AWS Chatbot User Guide.
Slack Channel ID: Right-click on the channel name in the left pane, then choose Copy Link. The channel ID is the 9-character string at the end of the URL.
A full example is contained in the examples directory.
module "budget_alarms" {
source = "rribeiro1/budget-alarms/aws"
version = "0.0.7" # verify the last version in the terraform registry
account_name = "Development"
account_budget_limit = 100.5
services = {
EC2 = {
budget_limit = 50.25
},
S3 = {
budget_limit = 12.35
},
ECR = {
budget_limit = 10.5
}
}
notifications = {
warning = {
comparison_operator = "GREATER_THAN"
threshold = 100
threshold_type = "PERCENTAGE"
notification_type = "ACTUAL"
},
critical = {
comparison_operator = "GREATER_THAN"
threshold = 110
threshold_type = "PERCENTAGE"
notification_type = "ACTUAL"
}
}
slack_workspace_id = "12345678910"
slack_channel_id = "12345678910"
tags = {
Environment = "Development"
}
}
Make sure to set create_slack_integration = false
to disable the integration.
This list is not exhaustive and new AWS services can be added.
Service Key | Description |
---|---|
Athena | Amazon Athena. |
EC2 | Amazon Elastic Compute Cloud - Compute". |
ECR | Amazon EC2 Container Registry (ECR). |
ECS | Amazon EC2 Container Service. |
Kubernetes | Amazon Elastic Container Service for Kubernetes. |
EBS | Amazon Elastic Block Store. |
CloudFront | Amazon CloudFront. |
CloudTrail | AWS CloudTrail. |
CloudWatch | Amazon CloudWatch. |
Cognito | Amazon Cognito. |
Config | AWS Config. |
DynamoDB | Amazon DynamoDB. |
DMS | AWS Database Migration Service. |
ElastiCache | Amazon ElastiCache. |
ELB | Amazon Elastic Load Balancing. |
Gateway | Amazon API Gateway. |
Glue | AWS Glue. |
Kafka | Managed Streaming for Apache Kafka. |
KMS | AWS Key Management Service. |
Kinesis | Amazon Kinesis. |
Lambda | AWS Lambda. |
Lex | Amazon Lex. |
Matillion | Matillion ETL for Amazon Redshift. |
Pinpoint | AWS Pinpoint. |
Polly | Amazon Polly. |
Rekognition | Amazon Rekognition. |
RDS | Amazon Relational Database Service. |
Redshift | Amazon Redshift. |
S3 | Amazon Simple Storage Service. |
SFTP | AWS Transfer for SFTP. |
Route53 | Amazon Route 53. |
SageMaker | Amazon SageMaker. |
SecretsManager | AWS Secrets Manager. |
SES | Amazon Simple Email Service. |
SNS | Amazon Simple Notification Service. |
SQS | Amazon Simple Queue Service. |
Tax | Tax. |
VPC | Amazon Virtual Private Cloud. |
WAF | AWS WAF. |
XRay | AWS X-Ray. |
Implemented using Kitchen-Terraform.
- Export the variables
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
- Execute the commands:
bundle install
bundle exec kitchen test
Code formatting and documentation for variables and outputs are generated using pre-commit-terraform hooks which uses terraform-docs.
Follow these instructions to install pre-commit locally.
And install terraform-docs
with go get github.com/segmentio/terraform-docs
or brew install terraform-docs
.
Report issues/questions/feature requests on in the issues section.
No requirements.
Name | Version |
---|---|
aws | n/a |
local | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
account_budget_limit | Set the budget limit for the AWS account. | string |
n/a | yes |
account_name | Specifies the name of the AWS account | string |
"" |
no |
budget_limit_unit | The unit of measurement used for the budget forecast, actual spend, or budget threshold. | string |
"USD" |
no |
budget_time_unit | The length of time until a budget resets the actual and forecasted spend. Valid values: MONTHLY , QUARTERLY , ANNUALLY . |
string |
"MONTHLY" |
no |
create_slack_integration | Whether to create the Slack integration through AWS Chatbot or not. | bool |
true |
no |
notifications | Can be used multiple times to configure budget notification thresholds. | map(object({ |
n/a | yes |
services | Define the list of services and their limit of budget. | map(object({ |
n/a | yes |
slack_channel_id | The ID of the Slack channel. For example, ABCBBLZZZ. (Should be set when create_slack_integration is enabled). | string |
"" |
no |
slack_workspace_id | The ID of the Slack workspace authorized with AWS Chatbot. (Should be set when create_slack_integration is enabled). | string |
"" |
no |
tags | Additional tags. | map(string) |
{} |
no |
Name | Description |
---|---|
budget_alarms_sns_topic_arn | ARN identification of the budget alarms SNS topic. |
Apache 2 Licensed. See LICENSE for full details.