diff --git a/README.yaml b/README.yaml index 50aacde..47be9ba 100644 --- a/README.yaml +++ b/README.yaml @@ -75,6 +75,7 @@ usage: |- actions_enabled = true insufficient_data_actions = [] ok_actions = [] + treat_missing_data = "ignore" dimensions = { instance_id = module.ec2.instance_id[0] } diff --git a/main.tf b/main.tf index 42313da..252cd66 100644 --- a/main.tf +++ b/main.tf @@ -32,6 +32,7 @@ resource "aws_cloudwatch_metric_alarm" "default" { actions_enabled = var.actions_enabled insufficient_data_actions = var.insufficient_data_actions ok_actions = var.ok_actions + treat_missing_data = var.treat_missing_data tags = module.labels.tags dimensions = var.dimensions @@ -52,6 +53,7 @@ resource "aws_cloudwatch_metric_alarm" "expression" { actions_enabled = var.actions_enabled insufficient_data_actions = var.insufficient_data_actions ok_actions = var.ok_actions + treat_missing_data = var.treat_missing_data tags = module.labels.tags dynamic "metric_query" { for_each = var.query_expressions @@ -97,6 +99,7 @@ resource "aws_cloudwatch_metric_alarm" "anomaly" { actions_enabled = var.actions_enabled insufficient_data_actions = var.insufficient_data_actions ok_actions = var.ok_actions + treat_missing_data = var.treat_missing_data tags = module.labels.tags dynamic "metric_query" { for_each = var.query_expressions diff --git a/variables.tf b/variables.tf index d4aa742..7587b66 100644 --- a/variables.tf +++ b/variables.tf @@ -127,6 +127,12 @@ variable "insufficient_data_actions" { description = "The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state." } +variable "treat_missing_data" { + type = string + default = "missing" + description = "Sets how an alarm is going to handle missing data points." +} + variable "ok_actions" { type = list(any) default = []