-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 #712
Comments
We are also experiencing this. We are working in the Is it possible that terraform needs to place all alarms in |
@chrismdp I'm running into the same issue, I think this will only work if you are working in the Source: Monitoring Health Check Status and Getting Notifications. Is there any way to override the region for a specific resource ? Also I think the documentation of the EDIT: Here is my workaround, I created a module that will use a custom provider with the region hardcoded. variable "environment" {}
variable "domain_name" {}
variable "resource_path" {}
provider "aws" {
alias = "use1"
region = "us-east-1"
}
resource "aws_route53_health_check" "health_check" {
fqdn = "${var.domain_name}"
port = 443
type = "HTTPS"
resource_path = "${var.resource_path}"
measure_latency = true
request_interval = 30
failure_threshold = 3
tags = {
Name = "${var.environment}"
Origin = "terraform"
Environment = "${var.environment}"
}
}
resource "aws_cloudwatch_metric_alarm" "metric_alarm" {
provider = "aws.use1"
alarm_name = "${var.environment}-alarm-health-check"
comparison_operator = "LessThanThreshold"
evaluation_periods = "1"
metric_name = "HealthCheckStatus"
namespace = "AWS/Route53"
period = "60"
statistic = "Minimum"
threshold = "1"
alarm_description = "Send an alarm if ${var.environment} is down"
insufficient_data_actions = []
dimensions {
HealthCheckId = "${aws_route53_health_check.health_check.id}"
}
} |
We ran into this today, and reading through the AWS docs, this is indeed a limitation of Route53 and it's related health-check alarms. Others have alluded to it, but just to mentioned it explicitly: If you create a route53 health-check alarm "by hand" from the AWS console, you'll see they are always created in us-east-1. AWS Thread: https://forums.aws.amazon.com/thread.jspa?threadID=209680 That being said, @Techbrunch 's workaround is suitable. We should:
We need some sort of sensible default though. The alternative is an obnoxious "gotcha" lying around in the documentation so people to come across. At the same time, minimizing the amount of re-work later if AWS decides to re-architect route53 healthcheck alarms to work in more or all regions by still allowing the default to be changed might be ok. |
When using the above workaround at either the top level instantiation of the module or in the module itself the API returns:
I had to set another default provider block overriding the region within the module and remove any non us-east-1 or global resources to another module. |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @vikas027 as hashicorp/terraform#13895. It was migrated here as part of the provider split. The original body of the issue is below.
Terraform Version
0.9.1
and0.9.3
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
Alarm should have been created and visible in Route53 Healthcheck
Actual Behavior
INSUFFICIENT DATA
state and was not linked to Route53 HealthcheckSteps to Reproduce
run
terraform apply
after copying the above.tf
fileReferences
The text was updated successfully, but these errors were encountered: