Datadog Monitor via Terraform: Invalid operator

Viewed 1146

When I try to roll out my terraform code containing the following datadog_monitor

resource "datadog_monitor" "test_alert" {
  name               = "Test alert"
  type               = "log alert"
  message            = "Test alert message @test@example.com"

  query = "logs('service:myservice Some log message').index('main').rollup('count').last('5m') > 0"

  enable_logs_sample  = true
  notify_no_data      = false
  include_tags        = true

  tags = ["tag1:tag1value", "tag2:tag2value"]
}

this results in the following error message:

Error: error validating monitor: 400 Bad Request: {"errors": ["The value provided for parameter 'query' is invalid: invalid operator specified: "]}

According to the API description, the query field for log alerts should have this syntax: logs(query).index(index_name).rollup(rollup_method[, measure]).last(time_window) operator #, and > is listed as a valid operator.

Other questions in this field listed solutions that were largely unrelated to the error message, so I assume the issue is unrelated to the operator, but I haven't been able to figure out the issue so far.

1 Answers

As suggested by sonata, the problem was solved using backslack escaped double-quotes instead of single-quotes.

Related