import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; /** * Use this resource to create and manage New Relic notification channels. Details regarding supported products and permissions can be found [here](https://docs.newrelic.com/docs/alerts-applied-intelligence/notifications/destinations). * * A channel is an entity that is used to configure notifications. It is also called a message template. It is a separate entity from workflows, but a channel is required in order to create a workflow. * * ## Example Usage * * ##### [Webhook](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#webhook) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "webhook-example", * type: "WEBHOOK", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * properties: [{ * key: "payload", * value: "name: {{ foo }}", * label: "Payload Template", * }], * }); * ``` * See additional examples. * * ## Additional Examples * * > **NOTE:** We support all properties. The mentioned properties are just an example. * * ##### [ServiceNow](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#servicenow) * To see the properties’ keys for your account, check ServiceNow incidents table. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "servicenow-incident-example", * type: "SERVICENOW_INCIDENTS", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * properties: [ * { * key: "description", * value: "General description", * }, * { * key: "short_description", * value: "Short description", * }, * ], * }); * ``` * ##### [ServiceNowApp](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#servicenowapp) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "servicenow-app-example", * type: "SERVICE_NOW_APP", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * }); * ``` * * ##### [Email](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#email) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "email-example", * type: "EMAIL", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * properties: [ * { * key: "subject", * value: "New Subject Title", * }, * { * key: "customDetailsEmail", * value: "issue id - {{issueId}}", * }, * ], * }); * ``` * * ##### [Jira Classic](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#jira) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "jira-example", * type: "JIRA_CLASSIC", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "ERROR_TRACKING", * properties: [ * { * key: "project", * value: "10000", * label: "Project-Name", * }, * { * key: "issuetype", * value: "10004", * label: "Bug", * }, * { * key: "description", * value: "Issue ID: {{ issueId }}", * }, * { * key: "summary", * value: "{{ annotations.title.[0] }}", * }, * ], * }); * ``` * * ##### [PagerDuty with account integration](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#pagerduty) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "pagerduty-account-example", * type: "PAGERDUTY_ACCOUNT_INTEGRATION", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * properties: [ * { * key: "summary", * value: "General summary", * }, * { * key: "service", * label: "Service Name", * value: "PTQK3FM", * }, * { * key: "email", * value: "example@email.com", * }, * { * key: "customDetails", * value: `{ * \\"id\\":{{json issueId}}, * \\"IssueURL\\":{{json issuePageUrl}}, * \\"NewRelic priority\\":{{json priority}}, * \\"Total Incidents\\":{{json totalIncidents}}, * \\"Impacted Entities\\":\\"{{#each entitiesData.names}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"Runbook\\":\\"{{#each accumulations.runbookUrl}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"Description\\":\\"{{#each annotations.description}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"isCorrelated\\":{{json isCorrelated}}, * \\"Alert Policy Names\\":\\"{{#each accumulations.policyName}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"Alert Condition Names\\":\\"{{#each accumulations.conditionName}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"Workflow Name\\":{{json workflowName}} * } * `, * }, * ], * }); * ``` * * ##### [PagerDuty with service integration](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#pagerduty) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "pagerduty-account-example", * type: "PAGERDUTY_SERVICE_INTEGRATION", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * properties: [ * { * key: "summary", * value: "General summary", * }, * { * key: "customDetails", * value: `{ * \\"id\\":{{json issueId}}, * \\"IssueURL\\":{{json issuePageUrl}}, * \\"NewRelic priority\\":{{json priority}}, * \\"Total Incidents\\":{{json totalIncidents}}, * \\"Impacted Entities\\":\\"{{#each entitiesData.names}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"Runbook\\":\\"{{#each accumulations.runbookUrl}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"Description\\":\\"{{#each annotations.description}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"isCorrelated\\":{{json isCorrelated}}, * \\"Alert Policy Names\\":\\"{{#each accumulations.policyName}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"Alert Condition Names\\":\\"{{#each accumulations.conditionName}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}\\", * \\"Workflow Name\\":{{json workflowName}} * } * `, * }, * ], * }); * ``` * * #### Mobile Push * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "mobile-push-example", * type: "MOBILE_PUSH", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * }); * ``` * * #### [AWS Event Bridge](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#eventBridge) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "event-bridge-example", * type: "EVENT_BRIDGE", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * properties: [ * { * key: "eventSource", * value: "aws.partner/mydomain/myaccountid/name", * }, * { * key: "eventContent", * value: "{ id: {{ json issueId }} }", * }, * ], * }); * ``` * * #### [SLACK](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels/#slack) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "slack-example", * type: "SLACK", * destinationId: "00b6bd1d-ac06-4d3d-bd72-49551e70f7a8", * product: "IINT", * properties: [ * { * key: "channelId", * value: "123456", * }, * { * key: "customDetailsSlack", * value: "issue id - {{issueId}}", * }, * ], * }); * ``` * * #### [MICROSOFT_TEAMS](https://docs.newrelic.com/docs/alerts/get-notified/microsoft-teams-integrations/) * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const foo = new newrelic.NotificationChannel("foo", { * accountId: "12345678", * name: "ms-teams-example", * type: "MICROSOFT_TEAMS", * destinationId: "52d36b54-3d68-4ac4-9d0a-581febb91f2c", * product: "IINT", * properties: [ * { * key: "teamId", * value: "906379b4-f5ac-40fd-b242-d4faaa4d3963", * }, * { * key: "channelId", * value: "19:wk9tU4tSr335Y1cNiXOynredbi3lFoeabu0kybfmbBA1@thread.tacv2", * }, * { * key: "customDetails", * value: "{{ nrAccountId }}", * }, * ], * }); * ``` * * > **NOTE:** Sensitive data such as channel API keys, service keys, etc are not returned from the underlying API for security reasons and may not be set in state when importing. * * ## Full Scenario Example * * Create a destination resource and reference that destination to the channel resource: * * ### Create a destination * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const webhook_destination = new newrelic.NotificationDestination("webhook-destination", { * accountId: "12345678", * name: "destination-webhook", * type: "WEBHOOK", * properties: [{ * key: "url", * value: "https://webhook.mywebhook.com", * }], * authBasic: { * user: "username", * password: "password", * }, * }); * ``` * * ### Create a channel * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as newrelic from "@pulumi/newrelic"; * * const webhook_channel = new newrelic.NotificationChannel("webhook-channel", { * accountId: "12345678", * name: "channel-webhook", * type: "WEBHOOK", * destinationId: webhook_destination.id, * product: "IINT", * properties: [{ * key: "payload", * value: "{name: foo}", * label: "Payload Template", * }], * }); * ``` * * ## Additional Information * * More details about the channels API can be found [here](https://docs.newrelic.com/docs/apis/nerdgraph/examples/nerdgraph-api-notifications-channels). * ### Moving from Legacy Alert Channels to Notification Channels * As described in the documentation of this resource, channels can be created and managed using `newrelic.NotificationDestination` and `newrelic.NotificationChannel`. A combination of these resources is an alternative to the legacy resource `newrelic.AlertChannel`, which is **deprecated** and will be **removed in a future major release**, as stated in the documentation of the resource. * * If you're currently using `newrelic.AlertChannel` to manage channels, we **strongly recommend** migrating to these notifications-based resources at the earliest. * * Please refer to the examples in this page, or this example for illustrations on setting up channels with these resources. * * ## Import * * Channels can only be used by a single workflow, therefore importing them is not particularly useful, because in the UI channels are created upon workflow creation. * Additionally, the channel id isn't available via the UI, and you'd need to look it up with the `channels` query in the NerdGraph API. * That being said, importing is possible using - * ```terraform import newrelic_notification_destination.foo ``` */ export declare class NotificationChannel extends pulumi.CustomResource { /** * Get an existing NotificationChannel resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: NotificationChannelState, opts?: pulumi.CustomResourceOptions): NotificationChannel; /** * Returns true if the given object is an instance of NotificationChannel. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is NotificationChannel; /** * Determines the New Relic account where the notification channel will be created. Defaults to the account associated with the API key used. */ readonly accountId: pulumi.Output; /** * Indicates whether the channel is active. */ readonly active: pulumi.Output; /** * The id of the destination. */ readonly destinationId: pulumi.Output; /** * The name of the channel. */ readonly name: pulumi.Output; /** * The type of product. One of: `DISCUSSIONS`, `ERROR_TRACKING` or `IINT` (workflows). */ readonly product: pulumi.Output; /** * A nested block that describes a notification channel property. See Nested property blocks below for details. */ readonly properties: pulumi.Output; /** * The status of the channel. */ readonly status: pulumi.Output; /** * The type of channel. One of: `EMAIL`, `SERVICENOW_INCIDENTS`, `SERVICE_NOW_APP`, `WEBHOOK`, `JIRA_CLASSIC`, `MOBILE_PUSH`, `EVENT_BRIDGE`, `SLACK` and `SLACK_COLLABORATION`, `PAGERDUTY_ACCOUNT_INTEGRATION`, `PAGERDUTY_SERVICE_INTEGRATION`, `MICROSOFT_TEAMS` or `WORKFLOW_AUTOMATION`. */ readonly type: pulumi.Output; /** * Create a NotificationChannel resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: NotificationChannelArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering NotificationChannel resources. */ export interface NotificationChannelState { /** * Determines the New Relic account where the notification channel will be created. Defaults to the account associated with the API key used. */ accountId?: pulumi.Input; /** * Indicates whether the channel is active. */ active?: pulumi.Input; /** * The id of the destination. */ destinationId?: pulumi.Input; /** * The name of the channel. */ name?: pulumi.Input; /** * The type of product. One of: `DISCUSSIONS`, `ERROR_TRACKING` or `IINT` (workflows). */ product?: pulumi.Input; /** * A nested block that describes a notification channel property. See Nested property blocks below for details. */ properties?: pulumi.Input[] | undefined>; /** * The status of the channel. */ status?: pulumi.Input; /** * The type of channel. One of: `EMAIL`, `SERVICENOW_INCIDENTS`, `SERVICE_NOW_APP`, `WEBHOOK`, `JIRA_CLASSIC`, `MOBILE_PUSH`, `EVENT_BRIDGE`, `SLACK` and `SLACK_COLLABORATION`, `PAGERDUTY_ACCOUNT_INTEGRATION`, `PAGERDUTY_SERVICE_INTEGRATION`, `MICROSOFT_TEAMS` or `WORKFLOW_AUTOMATION`. */ type?: pulumi.Input; } /** * The set of arguments for constructing a NotificationChannel resource. */ export interface NotificationChannelArgs { /** * Determines the New Relic account where the notification channel will be created. Defaults to the account associated with the API key used. */ accountId?: pulumi.Input; /** * Indicates whether the channel is active. */ active?: pulumi.Input; /** * The id of the destination. */ destinationId: pulumi.Input; /** * The name of the channel. */ name?: pulumi.Input; /** * The type of product. One of: `DISCUSSIONS`, `ERROR_TRACKING` or `IINT` (workflows). */ product: pulumi.Input; /** * A nested block that describes a notification channel property. See Nested property blocks below for details. */ properties: pulumi.Input[]>; /** * The type of channel. One of: `EMAIL`, `SERVICENOW_INCIDENTS`, `SERVICE_NOW_APP`, `WEBHOOK`, `JIRA_CLASSIC`, `MOBILE_PUSH`, `EVENT_BRIDGE`, `SLACK` and `SLACK_COLLABORATION`, `PAGERDUTY_ACCOUNT_INTEGRATION`, `PAGERDUTY_SERVICE_INTEGRATION`, `MICROSOFT_TEAMS` or `WORKFLOW_AUTOMATION`. */ type: pulumi.Input; } //# sourceMappingURL=notificationChannel.d.ts.map