Skip to content

CCM-14044 Adding anomaly alarms#103

Merged
aidenvaines-cgi merged 3 commits intomainfrom
CCM-14044_EventAnnomAlarms
Mar 3, 2026
Merged

CCM-14044 Adding anomaly alarms#103
aidenvaines-cgi merged 3 commits intomainfrom
CCM-14044_EventAnnomAlarms

Conversation

@aidenvaines-cgi
Copy link
Contributor

@aidenvaines-cgi aidenvaines-cgi commented Mar 2, 2026

Description

Adding anomaly alarms for Eventbus inbound and outbound events.
Bumping terraform versions

Example in Dev working
image

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming
  • If I have used the 'skip-trivy-package' label I have done so responsibly and in the knowledge that this is being fixed as part of a separate ticket/PR.

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@aidenvaines-cgi aidenvaines-cgi requested review from a team as code owners March 2, 2026 13:29
@aidenvaines-cgi aidenvaines-cgi enabled auto-merge (squash) March 3, 2026 10:15
@aidenvaines-cgi aidenvaines-cgi merged commit 98d662b into main Mar 3, 2026
29 checks passed
@aidenvaines-cgi aidenvaines-cgi deleted the CCM-14044_EventAnnomAlarms branch March 3, 2026 11:38
@timireland timireland requested a review from Copilot March 3, 2026 11:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CloudWatch anomaly detection alarms to the events Terraform component to monitor EventBridge data/control plane ingestion and invocations, and bumps tool versions used for Terraform (and Trivy at repo level).

Changes:

  • Introduces 4 CloudWatch metric alarms using anomaly detection bands for EventBridge ingestion/invocations (data + control plane).
  • Adds configurable inputs/outputs to enable/parameterize and expose the anomaly alarms.
  • Updates .tool-versions (component + repo) to newer Terraform, and bumps Trivy in the repo root.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
infrastructure/terraform/components/events/variables.tf Adds toggles/tuning variables for anomaly detection alarms.
infrastructure/terraform/components/events/outputs.tf Exposes anomaly alarm names/ARNs when enabled.
infrastructure/terraform/components/events/cloudwatch_metric_alarm_data_plane_ingestion_anomaly.tf Creates data-plane ingestion anomaly detection alarm.
infrastructure/terraform/components/events/cloudwatch_metric_alarm_data_plane_invocations_anomaly.tf Creates data-plane invocations anomaly detection alarm.
infrastructure/terraform/components/events/cloudwatch_metric_alarm_control_plane_ingestion_anomaly.tf Creates control-plane ingestion anomaly detection alarm.
infrastructure/terraform/components/events/cloudwatch_metric_alarm_control_plane_invocations_anomaly.tf Creates control-plane invocations anomaly detection alarm.
infrastructure/terraform/components/events/README.md Updates generated TF docs for new inputs/outputs.
infrastructure/terraform/components/events/.tool-versions Bumps component Terraform tool version.
.tool-versions Bumps repo Terraform and Trivy tool versions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

variable "event_anomaly_evaluation_periods" {
type = number
description = "Number of evaluation periods for the anomaly alarm. Each period is defined by event_anomaly_period."
default = 2
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event_anomaly_evaluation_periods is declared as a number, but CloudWatch expects an integer >= 1. Without a validation block, non-integer/invalid values (e.g., 1.5 or 0) will only fail at apply time. Consider adding validation to enforce a positive whole number.

Suggested change
default = 2
default = 2
validation {
condition = var.event_anomaly_evaluation_periods >= 1 && floor(var.event_anomaly_evaluation_periods) == var.event_anomaly_evaluation_periods
error_message = "event_anomaly_evaluation_periods must be a positive whole number (integer >= 1)."
}

Copilot uses AI. Check for mistakes.
variable "event_anomaly_period" {
type = number
description = "The period in seconds over which the specified statistic is applied for anomaly detection. Minimum 300 seconds (5 minutes). Recommended: 300-600."
default = 300
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description for event_anomaly_period states a minimum of 300 seconds, but there’s no validation enforcing this (or that the value is an integer). Adding a validation block (e.g., >= 300 and whole number) would prevent configuration values that will be rejected by CloudWatch at apply time.

Suggested change
default = 300
default = 300
validation {
condition = var.event_anomaly_period >= 300 && floor(var.event_anomaly_period) == var.event_anomaly_period
error_message = "Event anomaly period must be an integer number of seconds and at least 300 seconds."
}

Copilot uses AI. Check for mistakes.
@@ -1 +1 @@
terraform 1.12.0
terraform 1.14.3
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bumps the asdf Terraform version to 1.14.3, but the module’s Terraform constraint still allows older versions (required_version = ">= 1.12.0" in infrastructure/terraform/components/events/versions.tf, also reflected in the generated README). If 1.14.3 is now the minimum supported version, consider updating required_version (and regenerating docs) to avoid contributors/CI running with an older Terraform than intended.

Suggested change
terraform 1.14.3
terraform 1.12.0

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants