<commit_before>resource "aws_cloudwatch_metric_alarm" "alarm_down" {
  count               = var.num_asg
  alarm_name          = "${var.name}-down${count.index}"
  comparison_operator = "LessThanOrEqualToThreshold"
  evaluation_periods  = var.evaluation_periods
  metric_name         = var.metric_name
  namespace           = var.namespace
  period              = var.period_down
  statistic           = var.statistic
  threshold           = var.threshold_down
  datapoints_to_alarm = var.datapoints_to_alarm_down

  dimensions = {
    "${var.dimension_name}" = coalesce(var.dimension_value, var.autoscaling_group_names[count.index])
  }

  alarm_description = "This metric monitors CPU utilization down"
  alarm_actions     = aws_autoscaling_policy.down.*.arn
}

resource "aws_cloudwatch_metric_alarm" "alarm_up" {
  count               = var.num_asg
  alarm_name          = "${var.name}-up${count.index}"
  comparison_operator = "GreaterThanOrEqualToThreshold"
  evaluation_periods  = var.evaluation_periods
  metric_name         = var.metric_name
  namespace           = var.namespace
  period              = var.period_up
  statistic           = var.statistic
  threshold           = var.threshold_up
  datapoints_to_alarm = var.datapoints_to_alarm_up

  dimensions = {
    "${var.dimension_name}" = coalesce(var.dimension_value, var.autoscaling_group_names[count.index])
  }

  alarm_description = "This metric monitors CPU utilization up"
  alarm_actions     = aws_autoscaling_policy.up.*.arn
}

resource "aws_autoscaling_policy" "up" {
  count                  = var.num_asg
  name                   = "${var.name}-up${count.index}"
  autoscaling_group_name = var.autoscaling_group_names[count.index]
  adjustment_type        = var.adjustment_type
  policy_type            = var.policy_type
  cooldown               = var.cooldown_up
  scaling_adjustment     = var.adjustment_up
}

resource "aws_autoscaling_policy" "down" {
  count                  = var.num_asg
  name                   = "${var.name}-down${count.index}"
  autoscaling_group_name = var.autoscaling_group_names[count.index]
  adjustment_type        = var.adjustment_type
  policy_type            = var.policy_type
  cooldown               = var.cooldown_down
  scaling_adjustment     = var.adjustment_down
}<commit_msg>revert<commit_after>resource "aws_cloudwatch_metric_alarm" "alarm_down" {
  count               = var.num_asg
  alarm_name          = "${var.name}-down${count.index}"
  comparison_operator = "LessThanOrEqualToThreshold"
  evaluation_periods  = var.evaluation_periods
  metric_name         = var.metric_name
  namespace           = var.namespace
  period              = var.period_down
  statistic           = var.statistic
  threshold           = var.threshold_down
  datapoints_to_alarm = var.datapoints_to_alarm_down

  dimensions = {
    var.dimension_name = coalesce(var.dimension_value, var.autoscaling_group_names[count.index])
  }

  alarm_description = "This metric monitors CPU utilization down"
  alarm_actions     = aws_autoscaling_policy.down.*.arn
}

resource "aws_cloudwatch_metric_alarm" "alarm_up" {
  count               = var.num_asg
  alarm_name          = "${var.name}-up${count.index}"
  comparison_operator = "GreaterThanOrEqualToThreshold"
  evaluation_periods  = var.evaluation_periods
  metric_name         = var.metric_name
  namespace           = var.namespace
  period              = var.period_up
  statistic           = var.statistic
  threshold           = var.threshold_up
  datapoints_to_alarm = var.datapoints_to_alarm_up

  dimensions = {
    var.dimension_name = coalesce(var.dimension_value, var.autoscaling_group_names[count.index])
  }

  alarm_description = "This metric monitors CPU utilization up"
  alarm_actions     = aws_autoscaling_policy.up.*.arn
}

resource "aws_autoscaling_policy" "up" {
  count                  = var.num_asg
  name                   = "${var.name}-up${count.index}"
  autoscaling_group_name = var.autoscaling_group_names[count.index]
  adjustment_type        = var.adjustment_type
  policy_type            = var.policy_type
  cooldown               = var.cooldown_up
  scaling_adjustment     = var.adjustment_up
}

resource "aws_autoscaling_policy" "down" {
  count                  = var.num_asg
  name                   = "${var.name}-down${count.index}"
  autoscaling_group_name = var.autoscaling_group_names[count.index]
  adjustment_type        = var.adjustment_type
  policy_type            = var.policy_type
  cooldown               = var.cooldown_down
  scaling_adjustment     = var.adjustment_down
}
{'fraction_non_alphanumeric': 0.08313279369940932, 'fraction_numerical': 0.0, 'mean_word_length': 2.7200976403580146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '755850', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1448, 'n_words': 212}