Skip to content

pbs/terraform-aws-cloudwatch-alarms-module

Repository files navigation

PBS TF CloudWatch Alarms Module

Installation

Using the Repo Source

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?ref=0.0.30

Alternative Installation Methods

More information can be found on these install methods and more in the documentation here.

Usage

This module provisions a CloudWatch alarm.

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?ref=0.0.30"

  namespace       = "AWS/Lambda"
  lambda_function = aws_lambda_function.lambda.id

  # Tagging Parameters
  organization = var.organization
  environment  = var.environment
  product      = var.product
  repo         = var.repo

  # Optional Parameters
}

Adding This Version of the Module

If this repo is added as a subtree, then the version of the module should be close to the version shown here:

0.0.30

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


Requirements

Name Version
terraform >= 1.3.2
aws >= 4.5.0

Providers

Name Version
aws 5.24.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_metric_alarm.alarm resource
aws_default_tags.common_tags data source

Inputs

Name Description Type Default Required
environment Environment (sharedtools, dev, staging, qa, prod) string n/a yes
namespace The namespace for the alarm's associated metric. See docs for the list of namespaces. See docs for supported metrics. 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
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
alarm_actions Actions to take when the CloudWatch Alarm fires. set(string) null no
alarm_description Description of the alarm being created. Defaults to Alarm for {local.name} Errors (High) if null. string null no
comparison_operator The arithmetic operation to use when comparing the specified Statistic and Threshold. The specified Statistic value is used as the first operand. Either of the following is supported: GreaterThanOrEqualToThreshold, GreaterThanThreshold, LessThanThreshold, LessThanOrEqualToThreshold. Additionally, the values LessThanLowerOrGreaterThanUpperThreshold, LessThanLowerThreshold, and GreaterThanUpperThreshold are used only for alarms based on anomaly detection models. string "GreaterThanOrEqualToThreshold" no
datapoints_to_alarm Datapoints to alarm. number 1 no
evaluation_periods The number of periods over which data is compared to the specified threshold. number 1 no
kinesis_stream Name of the Kinesis stream being monitored string null no
lambda_function Name of the Lambda function being monitored string null no
metric_name Metric to use for this alarm. string null no
name Name of the alarm being created. Defaults to product if null. string null no
period The period in seconds over which the specified statistic is applied. number 60 no
queue_name Name of the SQS queue being monitored string null no
sns_arn SNS topic ARN associated with Lambda that handles payload delivery. string null no
state_machine_arn ARN of the state machine being monitored string null no
statistic The statistic to apply to the alarm's associated metric. Any of the following are supported: SampleCount, Average, Sum, Minimum, Maximum. string "Sum" no
tags Extra tags map(string) {} no
threshold The value against which the specified statistic is compared. This parameter is required for alarms based on static thresholds, but should not be used for alarms based on anomaly detection models. string null no
treat_missing_data How to treat data that is missing. string "notBreaching" no

Outputs

Name Description
arn ARN of the alarm provisioned
name Name of the alarm provisioned