adding health-notifications module

ctalarms-whitelist
lalanza808 4 years ago
parent aeb0c5c5f7
commit 4cb017c825

@ -0,0 +1,35 @@
# health-notifications
This module sets up Cloudwatch Event rules which notify a given SNS topic to inform administrators of any health/operational events .
https://aws.amazon.com/premiumsupport/technology/personal-health-dashboard/
## Usage
```
module "sns-email-topic" {
source = "github.com/lalanza808/tf-modules.git/monitoring/sns-email-topic"
}
module "aws-health" {
source = "github.com/lalanza808/tf-modules.git/monitoring/health-notifications"
sns_topic_arn = module.sns-email-topic.topic_arn
}
```
## Inputs
You must provide one input, which is the SNS Topic ARN you wish to publish messages to.
* `sns_topic_arn`
You can provide these optional inputs:
* `prefix`
* `tags`
See all inputs here: [variables.tf](./variables.tf)
## Outputs
None

@ -0,0 +1,22 @@
resource "aws_cloudwatch_event_rule" "health" {
name = "${var.prefix}-aws-health"
description = "Capture AWS Health events and notify operations"
event_pattern = <<PATTERN
{
"source": [
"aws.health"
]
}
PATTERN
tags = {
Terraform = "True"
}
}
resource "aws_cloudwatch_event_target" "sns" {
rule = aws_cloudwatch_event_rule.health.name
target_id = "${var.prefix}-aws-health"
arn = var.sns_topic_arn
}

@ -0,0 +1,12 @@
variable "sns_topic_arn" {
description = "ARN of the SNS topic to recieve notifications"
}
variable "tags" {
default = {}
type = map
description = "Optional set of tags to apply to the infrastructure"
}
variable "prefix" {
default = "monitoring"
description = "String to prefix to all resources"
}
Loading…
Cancel
Save