2016-11-23 18:28:30 +01:00
|
|
|
---
|
|
|
|
layout: "newrelic"
|
|
|
|
page_title: "Provider: New Relic"
|
|
|
|
sidebar_current: "docs-newrelic-index"
|
|
|
|
description: |-
|
2017-02-18 23:48:50 +01:00
|
|
|
New Relic offers a performance management solution enabling developers to
|
2016-11-23 18:28:30 +01:00
|
|
|
diagnose and fix application performance problems in real time.
|
|
|
|
---
|
|
|
|
|
|
|
|
# New Relic Provider
|
|
|
|
|
2017-02-18 23:48:50 +01:00
|
|
|
[New Relic](https://newrelic.com/) offers a performance management solution
|
2016-11-23 18:28:30 +01:00
|
|
|
enabling developers to diagnose and fix application performance problems in real time.
|
|
|
|
|
|
|
|
Use the navigation to the left to read about the available resources.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 12:17:54 +02:00
|
|
|
```hcl
|
2016-11-23 18:28:30 +01:00
|
|
|
# Configure the New Relic provider
|
|
|
|
provider "newrelic" {
|
2017-02-18 23:48:50 +01:00
|
|
|
api_key = "${var.newrelic_api_key}"
|
2016-11-23 18:28:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Create an alert policy
|
|
|
|
resource "newrelic_alert_policy" "alert" {
|
2017-02-18 23:48:50 +01:00
|
|
|
name = "Alert"
|
2016-11-23 18:28:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Add a condition
|
|
|
|
resource "newrelic_alert_condition" "foo" {
|
|
|
|
policy_id = "${newrelic_alert_policy.alert.id}"
|
|
|
|
|
|
|
|
name = "foo"
|
|
|
|
type = "apm_app_metric"
|
2017-02-18 23:48:50 +01:00
|
|
|
entities = ["12345"] # You can look this up in New Relic
|
2016-11-23 18:28:30 +01:00
|
|
|
metric = "apdex"
|
|
|
|
runbook_url = "https://docs.example.com/my-runbook"
|
|
|
|
|
|
|
|
term {
|
|
|
|
duration = 5
|
|
|
|
operator = "below"
|
|
|
|
priority = "critical"
|
|
|
|
threshold = "0.75"
|
|
|
|
time_function = "all"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Add a notification channel
|
|
|
|
resource "newrelic_alert_channel" "email" {
|
|
|
|
name = "email"
|
2017-01-24 23:13:16 +01:00
|
|
|
type = "email"
|
|
|
|
|
|
|
|
configuration = {
|
2017-02-18 23:48:50 +01:00
|
|
|
recipients = "paul@example.com"
|
2017-01-24 23:13:16 +01:00
|
|
|
include_json_attachment = "1"
|
|
|
|
}
|
2016-11-23 18:28:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Link the channel to the policy
|
|
|
|
resource "newrelic_alert_policy_channel" "alert_email" {
|
|
|
|
policy_id = "${newrelic_alert_policy.alert.id}"
|
|
|
|
channel_id = "${newrelic_alert_channel.email.id}"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `api_key` - (Required) Your New Relic API key.
|