Skip to content

Conversation

@jeff-everett
Copy link
Contributor

This is helpful in adding cloud watch monitor(s) for a given number of healthy instances:

From the module invocation, where we specify the list of target groups:
target_groups = "${list (map ("name", "${var.app1}", "backend_protocol", "HTTP", "backend_port", "8080" ), (map ("name", "${var.app2}", "backend_protocol", "HTTP", "backend_port", "80" ) ) )}"

Cloudwatch usage:
`resource "aws_cloudwatch_metric_alarm" "app1_unhealthy_hosts" {
alarm_name = "${var.app1}-unhealthy-host"
comparison_operator = "LessThanThreshold"
datapoints_to_alarm = "3"
evaluation_periods = "5"
metric_name = "HealthyHostCount"
namespace = "AWS/ApplicationELB"
period = "60"
statistic = "Maximum"
threshold = "2"

dimensions {
TargetGroup = "${element(module.alb.target_group_arn_suffixes, 0)}"
LoadBalancer = "${module.alb.load_balancer_arn_suffix}"
}

alarm_description = "${var.environment} ${var.service} ${var.app1} instance(s) failing health checks."

alarm_actions = [
"${module.notify_slack.this_slack_topic_arn}",
"${aws_sns_topic.pagerduty.arn}"
]

ok_actions = [
"${module.notify_slack.this_slack_topic_arn}",
"${aws_sns_topic.pagerduty.arn}"
]
}`

@brandonjbjelland
Copy link
Contributor

Hey @jeff-everett 👋 Funny seeing you here, former teamy.

Everything looks good with your change. Thanks for the contribution and I'll cut a release with it shortly.

@brandonjbjelland brandonjbjelland self-requested a review May 3, 2018 03:48
@brandonjbjelland brandonjbjelland merged commit 07d4ece into terraform-aws-modules:master May 3, 2018
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants