AlertChannel
Use this resource to create and manage New Relic alert policies.
Additional Examples
Slack
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const foo = new newrelic.AlertChannel("foo", {
config: {
channel: "example-alerts-channel",
url: "https://<YourOrganization>.slack.com",
},
type: "slack",
});import pulumi
import pulumi_newrelic as newrelic
foo = newrelic.AlertChannel("foo",
config={
"channel": "example-alerts-channel",
"url": "https://<YourOrganization>.slack.com",
},
type="slack")using Pulumi;
using NewRelic = Pulumi.NewRelic;
class MyStack : Stack
{
public MyStack()
{
var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
{
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
Channel = "example-alerts-channel",
Url = "https://<YourOrganization>.slack.com",
},
Type = "slack",
});
}
}
OpsGenie
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const foo = new newrelic.AlertChannel("foo", {
config: {
apiKey: "abc123",
recipients: "user1@domain.com, user2@domain.com",
tags: "tag1, tag2",
teams: "team1, team2",
},
type: "opsgenie",
});import pulumi
import pulumi_newrelic as newrelic
foo = newrelic.AlertChannel("foo",
config={
"apiKey": "abc123",
"recipients": "user1@domain.com, user2@domain.com",
"tags": "tag1, tag2",
"teams": "team1, team2",
},
type="opsgenie")using Pulumi;
using NewRelic = Pulumi.NewRelic;
class MyStack : Stack
{
public MyStack()
{
var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
{
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
ApiKey = "abc123",
Recipients = "user1@domain.com, user2@domain.com",
Tags = "tag1, tag2",
Teams = "team1, team2",
},
Type = "opsgenie",
});
}
}
PagerDuty
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const foo = new newrelic.AlertChannel("foo", {
config: {
serviceKey: "abc123",
},
type: "pagerduty",
});import pulumi
import pulumi_newrelic as newrelic
foo = newrelic.AlertChannel("foo",
config={
"serviceKey": "abc123",
},
type="pagerduty")using Pulumi;
using NewRelic = Pulumi.NewRelic;
class MyStack : Stack
{
public MyStack()
{
var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
{
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
ServiceKey = "abc123",
},
Type = "pagerduty",
});
}
}
VictorOps
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const foo = new newrelic.AlertChannel("foo", {
config: {
key: "abc123",
routeKey: "/example",
},
type: "victorops",
});import pulumi
import pulumi_newrelic as newrelic
foo = newrelic.AlertChannel("foo",
config={
"key": "abc123",
"routeKey": "/example",
},
type="victorops")using Pulumi;
using NewRelic = Pulumi.NewRelic;
class MyStack : Stack
{
public MyStack()
{
var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
{
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
Key = "abc123",
RouteKey = "/example",
},
Type = "victorops",
});
}
}
Webhook
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const foo = new newrelic.AlertChannel("foo", {
type: "webhook",
config: {
baseUrl: "http://www.test.com",
payloadType: "application/json",
payload: {
condition_name: `$CONDITION_NAME`,
policy_name: `$POLICY_NAME`,
},
headers: {
header1: value1,
header2: value2,
},
},
});import pulumi
import pulumi_newrelic as newrelic
foo = newrelic.AlertChannel("foo",
type="webhook",
config={
"baseUrl": "http://www.test.com",
"payloadType": "application/json",
"payload": {
"condition_name": "$CONDITION_NAME",
"policy_name": "$POLICY_NAME",
},
"headers": {
"header1": value1,
"header2": value2,
},
})using Pulumi;
using NewRelic = Pulumi.NewRelic;
class MyStack : Stack
{
public MyStack()
{
var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
{
Type = "webhook",
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
BaseUrl = "http://www.test.com",
PayloadType = "application/json",
Payload =
{
{ "condition_name", "$CONDITION_NAME" },
{ "policy_name", "$POLICY_NAME" },
},
Headers =
{
{ "header1", value1 },
{ "header2", value2 },
},
},
});
}
}
Webhook with complex payload
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const foo = new newrelic.AlertChannel("foo", {
config: {
baseUrl: "http://www.test.com",
payloadString: `{
"my_custom_values": {
"condition_name": "$CONDITION_NAME",
"policy_name": "$POLICY_NAME"
}
}
`,
payloadType: "application/json",
},
type: "webhook",
});import pulumi
import pulumi_newrelic as newrelic
foo = newrelic.AlertChannel("foo",
config={
"baseUrl": "http://www.test.com",
"payloadString": """{
"my_custom_values": {
"condition_name": "$$CONDITION_NAME",
"policy_name": "$$POLICY_NAME"
}
}
""",
"payloadType": "application/json",
},
type="webhook")using Pulumi;
using NewRelic = Pulumi.NewRelic;
class MyStack : Stack
{
public MyStack()
{
var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
{
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
BaseUrl = "http://www.test.com",
PayloadString = @"{
""my_custom_values"": {
""condition_name"": ""$$CONDITION_NAME"",
""policy_name"": ""$$POLICY_NAME""
}
}
",
PayloadType = "application/json",
},
Type = "webhook",
});
}
}
Example Usage
using Pulumi;
using NewRelic = Pulumi.NewRelic;
class MyStack : Stack
{
public MyStack()
{
var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
{
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
IncludeJsonAttachment = "1",
Recipients = "foo@example.com",
},
Type = "email",
});
}
}
Coming soon!
import pulumi
import pulumi_newrelic as newrelic
foo = newrelic.AlertChannel("foo",
config={
"includeJsonAttachment": "1",
"recipients": "foo@example.com",
},
type="email")import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const foo = new newrelic.AlertChannel("foo", {
config: {
includeJsonAttachment: "1",
recipients: "foo@example.com",
},
type: "email",
});Create a AlertChannel Resource
new AlertChannel(name: string, args: AlertChannelArgs, opts?: CustomResourceOptions);def AlertChannel(resource_name, opts=None, config=None, name=None, type=None, __props__=None);func NewAlertChannel(ctx *Context, name string, args AlertChannelArgs, opts ...ResourceOption) (*AlertChannel, error)public AlertChannel(string name, AlertChannelArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args AlertChannelArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AlertChannelArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AlertChannelArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
AlertChannel Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The AlertChannel resource accepts the following input properties:
- Type string
The type of channel. One of:
email,slack,opsgenie,pagerduty,victorops, orwebhook.- Config
Pulumi.
New Relic. Inputs. Alert Channel Config Args A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.
- Name string
The name of the channel.
- Type string
The type of channel. One of:
email,slack,opsgenie,pagerduty,victorops, orwebhook.- Config
Alert
Channel Config A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.
- Name string
The name of the channel.
- type string
The type of channel. One of:
email,slack,opsgenie,pagerduty,victorops, orwebhook.- config
Alert
Channel Config A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.
- name string
The name of the channel.
- type str
The type of channel. One of:
email,slack,opsgenie,pagerduty,victorops, orwebhook.- config
Dict[Alert
Channel Config] A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.
- name str
The name of the channel.
Outputs
All input properties are implicitly available as output properties. Additionally, the AlertChannel resource produces the following output properties:
Look up an Existing AlertChannel Resource
Get an existing AlertChannel resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AlertChannelState, opts?: CustomResourceOptions): AlertChannelstatic get(resource_name, id, opts=None, config=None, name=None, type=None, __props__=None);func GetAlertChannel(ctx *Context, name string, id IDInput, state *AlertChannelState, opts ...ResourceOption) (*AlertChannel, error)public static AlertChannel Get(string name, Input<string> id, AlertChannelState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Config
Pulumi.
New Relic. Inputs. Alert Channel Config Args A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.
- Name string
The name of the channel.
- Type string
The type of channel. One of:
email,slack,opsgenie,pagerduty,victorops, orwebhook.
- Config
Alert
Channel Config A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.
- Name string
The name of the channel.
- Type string
The type of channel. One of:
email,slack,opsgenie,pagerduty,victorops, orwebhook.
- config
Alert
Channel Config A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.
- name string
The name of the channel.
- type string
The type of channel. One of:
email,slack,opsgenie,pagerduty,victorops, orwebhook.
- config
Dict[Alert
Channel Config] A nested block that describes an alert channel configuration. Only one config block is permitted per alert channel definition. See Nested config blocks below for details.
- name str
The name of the channel.
- type str
The type of channel. One of:
email,slack,opsgenie,pagerduty,victorops, orwebhook.
Supporting Types
AlertChannelConfig
- Api
Key string The API key for integrating with OpsGenie.
- Auth
Password string Specifies an authentication password for use with a channel. Supported by the
webhookchannel type.- Auth
Type string Specifies an authentication method for use with a channel. Supported by the
webhookchannel type. Only HTTP basic authentication is currently supported via the valueBASIC.- Auth
Username string Specifies an authentication username for use with a channel. Supported by the
webhookchannel type.- Base
Url string The base URL of the webhook destination.
- Channel string
The Slack channel to send notifications to. *
opsgenie- Headers Dictionary<string, string>
A map of key/value pairs that represents extra HTTP headers to be sent along with the webhook payload.
- Headers
String string Use instead of
headersif the desired payload is more complex than a list of key/value pairs (e.g. a set of headers that makes use of nested objects). The value provided should be a valid JSON string with escaped double quotes. Conflicts withheaders.- Include
Json stringAttachment 0or1. Flag for whether or not to attach a JSON document containing information about the associated alert to the email that is sent to recipients. *webhook- Key string
The key for integrating with VictorOps.
- Payload Dictionary<string, string>
A map of key/value pairs that represents the webhook payload. Must provide
payload_typeif setting this argument.- Payload
String string Use instead of
payloadif the desired payload is more complex than a list of key/value pairs (e.g. a payload that makes use of nested objects). The value provided should be a valid JSON string with escaped double quotes. Conflicts withpayload.- Payload
Type string Can either be
application/jsonorapplication/x-www-form-urlencoded. Thepayload_typeargument is required ifpayloadis set. *pagerduty- Recipients string
A set of recipients for targeting notifications. Multiple values are comma separated.
- Region string
The data center region to store your data. Valid values are
USandEU. Default isUS.- Route
Key string The route key for integrating with VictorOps. *
slack- Service
Key string Specifies the service key for integrating with Pagerduty. *
victorops- string
A set of tags for targeting notifications. Multiple values are comma separated.
- Teams string
A set of teams for targeting notifications. Multiple values are comma separated.
- Url string
Your organization’s Slack URL.
- User
Id string
- Api
Key string The API key for integrating with OpsGenie.
- Auth
Password string Specifies an authentication password for use with a channel. Supported by the
webhookchannel type.- Auth
Type string Specifies an authentication method for use with a channel. Supported by the
webhookchannel type. Only HTTP basic authentication is currently supported via the valueBASIC.- Auth
Username string Specifies an authentication username for use with a channel. Supported by the
webhookchannel type.- Base
Url string The base URL of the webhook destination.
- Channel string
The Slack channel to send notifications to. *
opsgenie- Headers map[string]string
A map of key/value pairs that represents extra HTTP headers to be sent along with the webhook payload.
- Headers
String string Use instead of
headersif the desired payload is more complex than a list of key/value pairs (e.g. a set of headers that makes use of nested objects). The value provided should be a valid JSON string with escaped double quotes. Conflicts withheaders.- Include
Json stringAttachment 0or1. Flag for whether or not to attach a JSON document containing information about the associated alert to the email that is sent to recipients. *webhook- Key string
The key for integrating with VictorOps.
- Payload map[string]string
A map of key/value pairs that represents the webhook payload. Must provide
payload_typeif setting this argument.- Payload
String string Use instead of
payloadif the desired payload is more complex than a list of key/value pairs (e.g. a payload that makes use of nested objects). The value provided should be a valid JSON string with escaped double quotes. Conflicts withpayload.- Payload
Type string Can either be
application/jsonorapplication/x-www-form-urlencoded. Thepayload_typeargument is required ifpayloadis set. *pagerduty- Recipients string
A set of recipients for targeting notifications. Multiple values are comma separated.
- Region string
The data center region to store your data. Valid values are
USandEU. Default isUS.- Route
Key string The route key for integrating with VictorOps. *
slack- Service
Key string Specifies the service key for integrating with Pagerduty. *
victorops- string
A set of tags for targeting notifications. Multiple values are comma separated.
- Teams string
A set of teams for targeting notifications. Multiple values are comma separated.
- Url string
Your organization’s Slack URL.
- User
Id string
- api
Key string The API key for integrating with OpsGenie.
- auth
Password string Specifies an authentication password for use with a channel. Supported by the
webhookchannel type.- auth
Type string Specifies an authentication method for use with a channel. Supported by the
webhookchannel type. Only HTTP basic authentication is currently supported via the valueBASIC.- auth
Username string Specifies an authentication username for use with a channel. Supported by the
webhookchannel type.- base
Url string The base URL of the webhook destination.
- channel string
The Slack channel to send notifications to. *
opsgenie- headers {[key: string]: string}
A map of key/value pairs that represents extra HTTP headers to be sent along with the webhook payload.
- headers
String string Use instead of
headersif the desired payload is more complex than a list of key/value pairs (e.g. a set of headers that makes use of nested objects). The value provided should be a valid JSON string with escaped double quotes. Conflicts withheaders.- include
Json stringAttachment 0or1. Flag for whether or not to attach a JSON document containing information about the associated alert to the email that is sent to recipients. *webhook- key string
The key for integrating with VictorOps.
- payload {[key: string]: string}
A map of key/value pairs that represents the webhook payload. Must provide
payload_typeif setting this argument.- payload
String string Use instead of
payloadif the desired payload is more complex than a list of key/value pairs (e.g. a payload that makes use of nested objects). The value provided should be a valid JSON string with escaped double quotes. Conflicts withpayload.- payload
Type string Can either be
application/jsonorapplication/x-www-form-urlencoded. Thepayload_typeargument is required ifpayloadis set. *pagerduty- recipients string
A set of recipients for targeting notifications. Multiple values are comma separated.
- region string
The data center region to store your data. Valid values are
USandEU. Default isUS.- route
Key string The route key for integrating with VictorOps. *
slack- service
Key string Specifies the service key for integrating with Pagerduty. *
victorops- string
A set of tags for targeting notifications. Multiple values are comma separated.
- teams string
A set of teams for targeting notifications. Multiple values are comma separated.
- url string
Your organization’s Slack URL.
- user
Id string
- api_
key str The API key for integrating with OpsGenie.
- auth
Password str Specifies an authentication password for use with a channel. Supported by the
webhookchannel type.- auth
Type str Specifies an authentication method for use with a channel. Supported by the
webhookchannel type. Only HTTP basic authentication is currently supported via the valueBASIC.- auth
Username str Specifies an authentication username for use with a channel. Supported by the
webhookchannel type.- base
Url str The base URL of the webhook destination.
- channel str
The Slack channel to send notifications to. *
opsgenie- headers Dict[str, str]
A map of key/value pairs that represents extra HTTP headers to be sent along with the webhook payload.
- headers
String str Use instead of
headersif the desired payload is more complex than a list of key/value pairs (e.g. a set of headers that makes use of nested objects). The value provided should be a valid JSON string with escaped double quotes. Conflicts withheaders.- include
Json strAttachment 0or1. Flag for whether or not to attach a JSON document containing information about the associated alert to the email that is sent to recipients. *webhook- key str
The key for integrating with VictorOps.
- payload Dict[str, str]
A map of key/value pairs that represents the webhook payload. Must provide
payload_typeif setting this argument.- payload
String str Use instead of
payloadif the desired payload is more complex than a list of key/value pairs (e.g. a payload that makes use of nested objects). The value provided should be a valid JSON string with escaped double quotes. Conflicts withpayload.- payload
Type str Can either be
application/jsonorapplication/x-www-form-urlencoded. Thepayload_typeargument is required ifpayloadis set. *pagerduty- recipients str
A set of recipients for targeting notifications. Multiple values are comma separated.
- region str
The data center region to store your data. Valid values are
USandEU. Default isUS.- route
Key str The route key for integrating with VictorOps. *
slack- service
Key str Specifies the service key for integrating with Pagerduty. *
victorops- str
A set of tags for targeting notifications. Multiple values are comma separated.
- teams str
A set of teams for targeting notifications. Multiple values are comma separated.
- url str
Your organization’s Slack URL.
- user
Id str
Package Details
- Repository
- https://github.com/pulumi/pulumi-newrelic
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
newrelicTerraform Provider.