resource "newrelic_alert_policy" "foo" {
name = "foo"
}
resource "newrelic_nrql_alert_condition" "foo" {
policy_id = "${newrelic_alert_policy.foo.id}"
name = "foo"
runbook_url = "https://www.example.com"
enabled = true
term {
duration = 5
operator = "below"
priority = "critical"
threshold = "1"
time_function = "all"
}
nrql {
query = "SELECT count(*) FROM SyntheticCheck WHERE monitorId = '<monitorId>'"
since_value = "3"
}
value_function = "single_value"
}
The following arguments are supported:
policy_id - (Required) The ID of the policy where this condition should be used. name - (Required) The title of the condition runbook_url - (Optional) Runbook URL to display in notifications. enabled - (Optional) Set whether to enable the alert condition. Defaults to true. term - (Required) A list of terms for this condition. See Terms below for details. nrql - (Required) A NRQL query. See NRQL below for details. value_function - (Optional) Possible values are single_value, sum. The term mapping supports the following arguments:
duration - (Required) In minutes, must be: 1, 2, 3, 4, 5, 10, 15, 30, 60, or 120. operator - (Optional) above, below, or equal. Defaults to equal. priority - (Optional) critical or warning. Defaults to critical. threshold - (Required) Must be 0 or greater. time_function - (Required) all or any. The nrql attribute supports the following arguments: * query - (Required) The NRQL query to execute for the condition * since_value - (Required) The value to be used in the SINCE <X> MINUTES AGO clause for the NRQL query. Must be: 1, 2, 3, 4, or 5.
The following attributes are exported:
id - The ID of the NRQL alert condition. Alert conditions can be imported using the id, e.g.
$ terraform import newrelic_nrql_alert_condition.main 12345
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/newrelic/r/nrql_alert_condition.html