Skip to content

AWS Cloudwatch Alarm Terraform module for Rackspace customers

License

Notifications You must be signed in to change notification settings

rackspace-infrastructure-automation/aws-terraform-cloudwatch_alarm

Repository files navigation

aws-terraform-cloudwatch_alarm

This module deploys a customized CloudWatch Alarm, for use in generating customer notifications or Rackspace support tickets.

Basic Usage

module "alarm" {
 source = "git@github.com:rackspace-infrastructure-automation/aws-terraform-cloudwatch_alarm//?ref=v0.12.6"

 alarm_description        = "High CPU usage."
 comparison_operator      = "GreaterThanThreshold"
 customer_alarms_enabled  = true
 evaluation_periods       = 5
 metric_name              = "CPUUtilization"
 notification_topic       = [var.notification_topic]
 name                     = "MyCloudWatchAlarm"
 namespace                = "AWS/EC2"
 period                   = 60
 rackspace_alarms_enabled = true
 rackspace_managed        = true
 severity                 = "urgent"
 statistic                = "Average"
 threshold                = 90

 dimension {
   InstanceId = "i-123456"
 }
}

Full working references are available at examples

Terraform 0.12 upgrade

There should be no changes required to move from previous versions of this module to version 0.12.0 or higher.

Module variables

The following module variables changes have occurred:

Deprecations

  • alarm_name - marked for deprecation as it no longer meets our style guide standards.

Additions

  • name - introduced as a replacement for alarm_name to better align with our style guide standards.

Removals

  • None

Requirements

Name Version
terraform >= 1.0.0
aws >= 2.7.0

Providers

Name Version
aws >= 2.7.0

Modules

No Modules.

Resources

Name
aws_caller_identity
aws_cloudwatch_metric_alarm
aws_region

Inputs

Name Description Type Default Required
alarm_count The number of alarms to create. number 1 no
alarm_description The description for the alarm. string "" no
alarm_name The descriptive name for the alarm. This name must be unique within the user's AWS account. [Deprecated in favor of name]. It will be removed in future releases. name supercedes the alarm_name. Either name or alarm_name must contain a non-default value. string "" 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. string n/a yes
customer_alarms_cleared Specifies whether alarms will notify customers when returning to an OK status. bool false no
customer_alarms_enabled Specifies whether alarms will notify customers. Automatically enabled if rackspace_managed is set to false bool false no
dimensions The list of dimensions for the alarm's associated metric. For the list of available dimensions see the AWS documentation here. list(map(string)) n/a yes
environment Application environment for which this network is being created. Preferred value are Development, Integration, PreProduction, Production, QA, Staging, or Test string "Development" no
evaluation_periods The number of periods over which data is compared to the specified threshold. number n/a yes
metric_name The name for the alarm's associated metric. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CW_Support_For_AWS.html for supported metrics. string n/a yes
name The descriptive name for the alarm. This name must be unique within the user's AWS account. name supercedes the deprecated alarm_name. Either name or alarm_name must contain a non-default value. string "" no
namespace The namespace for the alarm's associated metric. See https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/aws-namespaces.html for the list of namespaces. string n/a yes
notification_topic List of SNS Topic ARNs to use for customer notifications. list(string) [] no
period The period in seconds over which the specified statistic is applied. number 60 no
rackspace_alarms_enabled Specifies whether alarms will create a Rackspace ticket. Ignored if rackspace_managed is set to false bool false no
rackspace_managed Boolean parameter controlling if instance will be fully managed by Rackspace support teams, created CloudWatch alarms that generate tickets, and utilize Rackspace managed SSM documents. bool true no
severity The desired severity of the created Rackspace ticket. Supported values include: standard, urgent, emergency string "standard" no
statistic The statistic to apply to the alarm's associated metric. Either of the following is supported: SampleCount, Average, Sum, Minimum, Maximum string "Average" no
tags A map of tags to apply to all resources. map(string) {} no
threshold The value against which the specified statistic is compared. string n/a yes
treat_missing_data Sets how this alarm is to handle missing data points. The following values are supported: missing, ignore, breaching and notBreaching. Defaults to missing string "missing" no
unit The unit for the alarm's associated metric string null no

Outputs

Name Description
alarm_id List of created alarm names