Terraform module that creates AWS Budgets for your resources on AWS and through the AWS Chatbot integration, enables you to receive the alerts directly into 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
.
You must perform the initial authorization flow with Slack in the AWS Chatbot console. Then you can copy and paste the workspace ID from the console. For more details, see steps 1-4 in Setting Up AWS Chatbot with Slack in the AWS Chatbot User Guide.
Open Slack, 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. For example, ABCBBLZZZ.
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
budget_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"
}
}
If you don't want to create the integration between AWS Chatbot and Slack you should specify create_slack_integration = false
as argument.
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. |
EFS | Amazon Elastic File System. |
ELB | Amazon Elastic Load Balancing. |
Gateway | Amazon API Gateway. |
Glue | AWS Glue. |
Guardduty | Amazon GuardDuty. |
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. |
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 |
budget_name | Specifies the budget name | string |
"" |
no |
budget_limit_unit | The unit of measurement used for the budget forecast, actual spend, or budget threshold. | string |
"USD" |
no |
budget_alarm_sns_topic_arn | Specify a preexisting SNS topic | string |
n/a | 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 |
use_amortized | Specifies whether the budget uses the amortized rate | bool |
n/a | false |
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. To get the ID, open Slack, 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. For example, ABCBBLZZZ. | string |
n/a | yes |
slack_workspace_id | The ID of the Slack workspace authorized with AWS Chatbot. To get the workspace ID, you must perform the initial authorization flow with Slack in the AWS Chatbot console. Then you can copy and paste the workspace ID from the console. For more details, see steps 1-4 in Setting Up AWS Chatbot with Slack in the AWS Chatbot User Guide. | string |
n/a | yes |
tags | Additional tags | map(string) |
{} |
no |
Name | Description |
---|---|
budget_alarms_sns_topic_arn | ARN identification of the budget alarms SNS topic. |
Module managed by Rafael Ribeiro.
Apache 2 Licensed. See LICENSE for full details.