Closed jfirebaugh closed 1 year ago
Hi,
I believe you need to use the formula support to express that monitor. If you click on Export
in the UI it should give you the proper format. It should look something like that:
resource "datadog_monitor" "monitor" {
name = "test"
message = "message"
type = "ci-pipelines alert"
query = "formula(\"(query1 / query2) * 100\").last(\"5m\") > 5"
variables {
event_query {
data_source = "ci_pipelines"
name = "query1"
indexes = ["*"]
compute {
aggregation = "count"
}
search {
query = "ci_level:job @ci.job.retry_count:>=1 @buildkite.queue:production-*"
}
}
event_query {
data_source = "ci_pipelines"
name = "query2"
indexes = ["*"]
compute {
aggregation = "count"
}
search {
query = "ci_level:job @buildkite.queue:production-*"
}
}
}
}
Let us know if that works for you, thanks.
Yes, that works, thanks!
Steps to Reproduce
Create a CI pipeline monitor in the Datadog UI that uses the following configuration:
terraform import
to import it into a terraform configuration. Set thequery
attribute to the value shown in the Datadog UI:Run
terraform apply
.Expected Behavior
Apply succeeds.
Actual Behavior
Validation error.
Terraform Version
Terraform v1.1.3 on darwin_arm64
Affected Resource(s)
Terraform Configuration Files
Debug Output