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

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)
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, or webhook.

Config Pulumi.NewRelic.Inputs.AlertChannelConfigArgs

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, or webhook.

Config AlertChannelConfig

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, or webhook.

config AlertChannelConfig

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, or webhook.

config Dict[AlertChannelConfig]

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:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

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): AlertChannel
static 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.NewRelic.Inputs.AlertChannelConfigArgs

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, or webhook.

Config AlertChannelConfig

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, or webhook.

config AlertChannelConfig

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, or webhook.

config Dict[AlertChannelConfig]

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, or webhook.

Supporting Types

AlertChannelConfig

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

ApiKey string

The API key for integrating with OpsGenie.

AuthPassword string

Specifies an authentication password for use with a channel. Supported by the webhook channel type.

AuthType string

Specifies an authentication method for use with a channel. Supported by the webhook channel type. Only HTTP basic authentication is currently supported via the value BASIC.

AuthUsername string

Specifies an authentication username for use with a channel. Supported by the webhook channel type.

BaseUrl 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.

HeadersString string

Use instead of headers if 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 with headers.

IncludeJsonAttachment string

0 or 1. 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_type if setting this argument.

PayloadString string

Use instead of payload if 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 with payload.

PayloadType string

Can either be application/json or application/x-www-form-urlencoded. The payload_type argument is required if payload is 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 US and EU. Default is US.

RouteKey string

The route key for integrating with VictorOps. * slack

ServiceKey string

Specifies the service key for integrating with Pagerduty. * victorops

Tags 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.

UserId string
ApiKey string

The API key for integrating with OpsGenie.

AuthPassword string

Specifies an authentication password for use with a channel. Supported by the webhook channel type.

AuthType string

Specifies an authentication method for use with a channel. Supported by the webhook channel type. Only HTTP basic authentication is currently supported via the value BASIC.

AuthUsername string

Specifies an authentication username for use with a channel. Supported by the webhook channel type.

BaseUrl 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.

HeadersString string

Use instead of headers if 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 with headers.

IncludeJsonAttachment string

0 or 1. 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_type if setting this argument.

PayloadString string

Use instead of payload if 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 with payload.

PayloadType string

Can either be application/json or application/x-www-form-urlencoded. The payload_type argument is required if payload is 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 US and EU. Default is US.

RouteKey string

The route key for integrating with VictorOps. * slack

ServiceKey string

Specifies the service key for integrating with Pagerduty. * victorops

Tags 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.

UserId string
apiKey string

The API key for integrating with OpsGenie.

authPassword string

Specifies an authentication password for use with a channel. Supported by the webhook channel type.

authType string

Specifies an authentication method for use with a channel. Supported by the webhook channel type. Only HTTP basic authentication is currently supported via the value BASIC.

authUsername string

Specifies an authentication username for use with a channel. Supported by the webhook channel type.

baseUrl 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.

headersString string

Use instead of headers if 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 with headers.

includeJsonAttachment string

0 or 1. 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_type if setting this argument.

payloadString string

Use instead of payload if 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 with payload.

payloadType string

Can either be application/json or application/x-www-form-urlencoded. The payload_type argument is required if payload is 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 US and EU. Default is US.

routeKey string

The route key for integrating with VictorOps. * slack

serviceKey string

Specifies the service key for integrating with Pagerduty. * victorops

tags 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.

userId string
api_key str

The API key for integrating with OpsGenie.

authPassword str

Specifies an authentication password for use with a channel. Supported by the webhook channel type.

authType str

Specifies an authentication method for use with a channel. Supported by the webhook channel type. Only HTTP basic authentication is currently supported via the value BASIC.

authUsername str

Specifies an authentication username for use with a channel. Supported by the webhook channel type.

baseUrl 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.

headersString str

Use instead of headers if 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 with headers.

includeJsonAttachment str

0 or 1. 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_type if setting this argument.

payloadString str

Use instead of payload if 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 with payload.

payloadType str

Can either be application/json or application/x-www-form-urlencoded. The payload_type argument is required if payload is 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 US and EU. Default is US.

routeKey str

The route key for integrating with VictorOps. * slack

serviceKey str

Specifies the service key for integrating with Pagerduty. * victorops

tags 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.

userId str

Package Details

Repository
https://github.com/pulumi/pulumi-newrelic
License
Apache-2.0
Notes
This Pulumi package is based on the newrelic Terraform Provider.