NEW: monitor health events with eventbridge
Signed-off-by: xpk <xpk@headdesk.me>
This commit is contained in:
parent
e627637d21
commit
d9cad6b7a3
@ -0,0 +1,5 @@
|
|||||||
|
# Monitoring module
|
||||||
|
This module deploys the default cloudwatch metric monitoring
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
Terraform lifecycle ignores tags to speed up terraform subsequent update. Cloudwatch alarm tags cannot be read on aws console anyway.
|
22
modules/ManagementGovernance/Monitoring.EventBridge/main.tf
Normal file
22
modules/ManagementGovernance/Monitoring.EventBridge/main.tf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
resource "aws_cloudwatch_event_rule" "EventRule" {
|
||||||
|
name = "${var.cw-alarm-prefix}-health-events"
|
||||||
|
description = "A CloudWatch Event Rule that triggers on changes in the status of AWS Personal Health Dashboard (AWS Health) and forwards the events to an SNS topic."
|
||||||
|
is_enabled = var.actions-enabled
|
||||||
|
event_pattern = <<PATTERN
|
||||||
|
{
|
||||||
|
"detail-type": [
|
||||||
|
"AWS Health Event"
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"aws.health"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
PATTERN
|
||||||
|
tags = var.default-tags
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_cloudwatch_event_target" "TargetForEventRule" {
|
||||||
|
rule = aws_cloudwatch_event_rule.EventRule.name
|
||||||
|
target_id = "rackspace-standard-sns"
|
||||||
|
arn = var.sns-targets.alarm-actions-standard
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
terraform {
|
||||||
|
required_version = "~> 1.3.0"
|
||||||
|
required_providers {
|
||||||
|
aws = {
|
||||||
|
source = "hashicorp/aws"
|
||||||
|
version = "~> 4.36.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
variable cw-alarm-prefix {}
|
||||||
|
variable actions-enabled {}
|
||||||
|
|
||||||
|
variable sns-targets {}
|
||||||
|
variable default-tags {}
|
Loading…
Reference in New Issue
Block a user