github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/newrelic/r/alert_condition.html.markdown (about) 1 --- 2 layout: "newrelic" 3 page_title: "New Relic: newrelic_alert_condition" 4 sidebar_current: "docs-newrelic-resource-alert-condition" 5 description: |- 6 Create and manage an alert condition for a policy in New Relic. 7 --- 8 9 # newrelic\_alert\_condition 10 11 ## Example Usage 12 13 ```hcl 14 data "newrelic_application" "app" { 15 name = "my-app" 16 } 17 18 resource "newrelic_alert_policy" "foo" { 19 name = "foo" 20 } 21 22 resource "newrelic_alert_condition" "foo" { 23 policy_id = "${newrelic_alert_policy.foo.id}" 24 25 name = "foo" 26 type = "apm_app_metric" 27 entities = ["${data.newrelic_application.app.id}"] 28 metric = "apdex" 29 runbook_url = "https://www.example.com" 30 31 term { 32 duration = 5 33 operator = "below" 34 priority = "critical" 35 threshold = "0.75" 36 time_function = "all" 37 } 38 } 39 ``` 40 41 ## Argument Reference 42 43 The following arguments are supported: 44 45 * `policy_id` - (Required) The ID of the policy where this condition should be used. 46 * `name` - (Required) The title of the condition 47 * `type` - (Required) The type of condition. One of: `apm_app_metric`, `apm_kt_metric`, `servers_metric`, `browser_metric`, `mobile_metric` 48 * `entities` - (Required) The instance IDS associated with this condition. 49 * `metric` - (Required) The metric field accepts parameters based on the `type` set. 50 * `runbook_url` - (Optional) Runbook URL to display in notifications. 51 * `condition_scope` - (Optional) `instance` or `application`. This is required if you are using the JVM plugin in New Relic. 52 * `term` - (Required) A list of terms for this condition. See [Terms](#terms) below for details. 53 * `user_defined_metric` - (Optional) A custom metric to be evaluated. 54 * `user_defined_value_function` - (Optional) One of: `average`, `min`, `max`, `total`, or `sample_size`. 55 56 ## Terms 57 58 The `term` mapping supports the following arguments: 59 60 * `duration` - (Required) In minutes, must be: `5`, `10`, `15`, `30`, `60`, or `120`. 61 * `operator` - (Optional) `above`, `below`, or `equal`. Defaults to `equal`. 62 * `priority` - (Optional) `critical` or `warning`. Defaults to `critical`. 63 * `threshold` - (Required) Must be 0 or greater. 64 * `time_function` - (Required) `all` or `any`. 65 66 ## Attributes Reference 67 68 The following attributes are exported: 69 70 * `id` - The ID of the alert condition. 71 72 ## Import 73 74 Alert conditions can be imported using the `id`, e.g. 75 76 ``` 77 $ terraform import newrelic_alert_condition.main 12345 78 ```