terraform-provider-datadog
terraform-provider-datadog copied to clipboard
Data source for query value
What resources or data sources are affected?
none affected as far as i know
Feature Request
New data source that returns the current value of a query in datadog. Currently trying to set the threshold of a monitor as a query which cant be done. Would it be possible to add a data source so that we could get the current value from a query before we create the monitor so that it is a static constant for our threshold.
References
No response
Hello, could you provide an example, is query referring to a value of a metric?
Yes sorry I mean metric instead of query, I was trying to do something like(fake example but same idea):
locals {
critical_threshold = sum:aws.kafka.messages_in_per_sec{topic:${var.topic},cluster_name:${var.kafka_cluster},region:${var.region},consumer_group:${var.consumer_group}}
}
resource "datadog_monitor" "kafka_topic_high_offset_lag_warning" {
# Alert if the kafka topic has more messages than the critical value
name = "${var.service}: Offset lag is above threshold for ${var.topic_name}"
type = "metric alert"
query = "avg(last_30m): sum:aws.kafka.offset_lag{topic:${var.topic_name},cluster_name:${var.kafka_cluster},region:${var.region},consumer_group:${var.consumer_group}} >= ${local.critical_threshold}"
}
but kept getting an error because the threshold was not a constant, I was wondering if it would be possible to have a datasource that would grab the current value of a metric at the time of running a plan so that it could be used as a constant in the threshold of our monitor