Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Create Cloudwatch Metric/Alarm in Route53 Healthcheck #13895

Closed
vikas027 opened this issue Apr 24, 2017 · 4 comments
Closed

Unable to Create Cloudwatch Metric/Alarm in Route53 Healthcheck #13895

vikas027 opened this issue Apr 24, 2017 · 4 comments

Comments

@vikas027
Copy link

vikas027 commented Apr 24, 2017

Terraform Version

0.9.1 and 0.9.3

Affected Resource(s)

Please list the resources as a list, for example:

  • aws_route53_health_check
  • aws_cloudwatch_metric_alarm

Terraform Configuration Files

resource "aws_route53_health_check" "health_check" {
  fqdn                  = "${var.name}-${var.environment_short}.${var.domain_name}"
  port                  = "${var.https_port}"
  type                  = "HTTPS"
  resource_path         = "/login"
  failure_threshold     = "3"
  request_interval      = "30"
  cloudwatch_alarm_name = "${var.name}-${var.environment_short}.${var.domain_name}"
  cloudwatch_alarm_region = "ap-southeast-2"
}

resource "aws_cloudwatch_metric_alarm" "alarm" {
  depends_on          = ["aws_route53_health_check.health_check"]
  alarm_name          = "${var.name}-${var.environment_short}.${var.domain_name}"
  comparison_operator = "LessThanOrEqualToThreshold"
  evaluation_periods  = "2"
  metric_name         = "AppHealthCheck"
  namespace           = "AWS/Route53"
  period              = "60"
  statistic           = "Minimum"
  threshold           = "0"
  alarm_description   = "This metric monitors application"

  dimensions = {
    HealthCheckId = "${aws_route53_health_check.health_check.id}"
  }
}

Expected Behavior

Alarm should have been created and visible in Route53 Healthcheck

Actual Behavior

  • Health check was created fine
  • Alarm got created but is in INSUFFICIENT DATA state and was not linked to Route53 Healthcheck
    2017-04-24_18-58-08

Steps to Reproduce

run terraform apply after copying the above .tf file

References

@mwpeterson
Copy link

On 0.9.3.

I had to remove cloudwatch_alarm_name and cloudwatch_alarm_region from the aws_route53_health_check resource to get the alarm to connect to the health check. It felt backwards. The HealthCheckId dimension was enough to wire them together.

@vikas027
Copy link
Author

vikas027 commented Apr 25, 2017

@mwpeterson I just saw your code here, I was too following this thread.
I think in the example you have missed deleting cloudwatch_alarm_name and cloudwatch_alarm_region from aws_route53_health_check.val1-hc resource.

I get below error if I do not delete these two parameters.

* Cycle: module.jenkins_master.aws_cloudwatch_metric_alarm.val1-alarm, module.jenkins_master.aws_route53_health_check.val1-hc

And if I delete the two parameters and execute terraform (0.9.3), resources gets applied but still, the alarm is not linked to Route53 Health check :( I have tried both HTTPS and TCP (as per your example) health checks.
2017-04-25_19-05-05

Is there any other resource(s) which is doing the magic for you?

@grayaii
Copy link
Contributor

grayaii commented Feb 22, 2018

So, basically there is no way to create a cloudwatch alarm for the route 53 health check?
I assume this is not the same cloudwatch alarm that the health check is using to determine the overall healthyness/unhealthiness?
alarms

@bflad
Copy link
Contributor

bflad commented Feb 26, 2018

@grayaii it may be possible, but this may be related to which region the CloudWatch alarm is created in, please see the discussion on the open issue: hashicorp/terraform-provider-aws#712 -- I'm going to lock this issue to consolidate discussion to the open issue.

@hashicorp hashicorp locked and limited conversation to collaborators Feb 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants