Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lupupaulsv/f7c19cfc2d1822715e8a90bbe4374fd9 to your computer and use it in GitHub Desktop.
Save lupupaulsv/f7c19cfc2d1822715e8a90bbe4374fd9 to your computer and use it in GitHub Desktop.
### terraform alarms for schedulers
resource "aws_cloudwatch_metric_alarm" "memory-critical-scheduler-1" {
alarm_name = "exago-${var.environment}-scheduler-1-memory-critical"
alarm_description = "Exago ${var.environment} scheduler-1 memory is critical."
comparison_operator = "LessThanOrEqualToThreshold"
evaluation_periods = "2"
alarm_description = "This alarm is for critical scheduler memory usage"
alarm_actions = ["${var.sns_topics["sev1"]}"]
threshold = "262144000"
metric_query {
id = "m1"
metric {
metric_name = "mem_total"
namespace = "exago-schedulers"
period = "60"
stat = "Average"
dimensions = {
host = "ip-172-31-30-70.us-west-2.compute.internal"
}
}
}
}
Error: Error applying plan:
1 error(s) occurred:
* module.alarms.aws_cloudwatch_metric_alarm.memory-critical-scheduler-1: 1 error(s) occurred:
* aws_cloudwatch_metric_alarm.memory-critical-scheduler-1: Creating metric alarm failed: ValidationError: Exactly one element of the metrics list should return data.
status code: 400, request id: f8e3ff7e-7e17-11e9-a1de-eb8f55cf2e51
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
@mariobede
Copy link

might need just to return one element and not the whole list. Don't see the metric list anywhere tho

@mariobede
Copy link

alarm_actions = ["${var.sns_topics["sev1"]}"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment