Use this URL for the source of the module. See the usage examples below for more details.
github.com/pbs/terraform-aws-cloudwatch-alarms-module-v2?ref=0.0.2
More information can be found on these install methods and more in the documentation here.
This module provisions multiple CloudWatch alarms and can send notifications to Slack via SNS topics and AmazonQ.
It is an opinionated module that will configure CloudWatch alarms with as little manual configuration as possible. See the examples located in the examples folder to see what kind of resources are supported.
Integrate this module like so:
module "alarm" {
source = "github.com/pbs/terraform-aws-cloudwatch-alarms-module-v2?ref=0.0.2"
name = "test-app"
alarms = [
{
name = "error-count-alarm"
description = "Alarm if more than 5 errors in 1 minute"
slack_channel_id = "C12345678"
log_group_name = "/ecs/test-app-log-group-name"
pattern = "ERROR"
metric_name = "error-count"
metric_namespace = "test-app"
metric_value = "1"
alarm_threshold = 5
alarm_period = 60
alarm_statistic = "Sum"
treat_missing_data = "notBreaching"
}
]
# Tagging Parameters
organization = var.organization
environment = var.environment
product = var.product
owner = var.owner
repo = var.repo
# Optional Parameters
}
If this repo is added as a subtree, then the version of the module should be close to the version shown here:
0.0.2
Note, however that subtrees can be altered as desired within repositories.
Further documentation on usage can be found here.
Below is automatically generated documentation on this Terraform module using terraform-docs
Name | Version |
---|---|
terraform | >= 1.3.2 |
aws | >= 5.61.0 |
Name | Version |
---|---|
aws | 6.3.0 |
No modules.
Name | Type |
---|---|
aws_chatbot_slack_channel_configuration.slack | resource |
aws_cloudwatch_log_metric_filter.filter | resource |
aws_cloudwatch_metric_alarm.alarm | resource |
aws_sns_topic.topic | resource |
aws_caller_identity.current | data source |
aws_default_tags.common_tags | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
environment | Environment (sharedtools, dev, staging, qa, prod) | string |
n/a | yes |
organization | Organization using this module. Used to prefix tags so that they are easily identified as being from your organization | string |
n/a | yes |
owner | Tag used to group resources according to owner | string |
n/a | yes |
product | Tag used to group resources according to product | string |
n/a | yes |
repo | Tag used to point to the repo using this module | string |
n/a | yes |
alarms | List of CloudWatch alert configurations for Slack notifications. Each object supports the following attributes: - name: (string) Unique name for the alert - description: (string) Description of the alarm - slack_channel_id: (string) Slack channel ID to send notifications to - log_group_name: (string) CloudWatch log group to monitor - pattern: (string) Filter pattern for log events https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html - metric_name: (string) Name of the custom metric - metric_namespace: (string) Namespace for the custom metric - metric_value: (string) Value to publish to the metric when the pattern matches (usually "1") - alarm_threshold: (number) Threshold for triggering the alarm - alarm_period: (number) Period (in seconds) over which data is evaluated - alarm_statistic: (string) Statistic to apply to the metric. Possible values: "Sum", "Average", "Minimum", "Maximum", "SampleCount" - treat_missing_data: (string) How to treat missing data. Possible values: "breaching", "notBreaching", "ignore", "missing" |
list(object({ |
[] |
no |
chatbot_role_arn | ARN of the IAM role for AWS Chatbot | string |
null |
no |
name | Name of the alarm being created. Defaults to product if null. | string |
null |
no |
slack_team_id | Slack team ID for AWS Chatbot integration | string |
"T0Y7JC3PF" |
no |
tags | Extra tags | map(string) |
{} |
no |
Name | Description |
---|---|
arns | ARN of the alarm provisioned |
names | Name of the alarm provisioned |