import * as pulumi from "@pulumi/pulumi";
/**
* Use this resource to map alert policies to alert channels in New Relic.
*
* > **WARNING:** The `newrelic.AlertPolicyChannel` resource is **deprecated** and will be **removed in a future major release**. As an alternative, you can map channels to policies using the resource `newrelic.Workflow`, with the channels to be mapped created using a combination of the newer resources `newrelic.NotificationDestination` and `newrelic.NotificationChannel`. We **strongly recommend** migrating to these new resources at the earliest. Please refer to this example for a detailed illustration on setting up channels and workflows with these resources.
*
* > **A note on the availability of this resource in Japan (JP).** Both `newrelic.AlertPolicyChannel` and its companion `newrelic.AlertChannel` are backed by the legacy REST v2 Alert Channels API, which was globally deprecated in 2024 - the same reason both resources have been marked deprecated for a while, as noted in the warning above. Because REST v2 is not provisioned on the New Relic Japan region, neither resource can be used there; a `pulumi preview` against a provider configured with `region = "JP"` fails early with an actionable error message.
Moving to the NerdGraph-based `newrelic.Workflow` paired with `newrelic.NotificationDestination` and `newrelic.NotificationChannel` is not a JP-only concern - it is highly essential in every region, so that your alerting keeps working when the REST v2 Alert Channels API is formally sunsetted. See the getting started guide for a walkthrough of wiring alert conditions, alert policies, notification destinations, notification channels, and workflows together in Terraform.
*
* ## Example Usage
*
* The example below will apply multiple alert channels to an existing New Relic alert policy.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as newrelic from "@pulumi/newrelic";
*
* // Fetches the data for this policy from your New Relic account
* // and is referenced in the newrelic_alert_policy_channel block below.
* const examplePolicy = newrelic.getAlertPolicy({
* name: "my-alert-policy",
* });
* // Creates an email alert channel.
* const emailChannel = new newrelic.AlertChannel("email_channel", {
* name: "bar",
* type: "email",
* config: {
* recipients: "foo@example.com",
* includeJsonAttachment: "1",
* },
* });
* // Creates a Slack alert channel.
* const slackChannel = new newrelic.AlertChannel("slack_channel", {
* name: "slack-channel-example",
* type: "slack",
* config: {
* channel: "#example-channel",
* url: "http://example-org.slack.com",
* },
* });
* // Applies the created channels above to the alert policy
* // referenced at the top of the config.
* const foo = new newrelic.AlertPolicyChannel("foo", {
* policyId: examplePolicy.then(examplePolicy => examplePolicy.id),
* channelIds: [
* emailChannel.id,
* slackChannel.id,
* ],
* });
* ```
*
* ## Import
*
* Alert policy channels can be imported using the following notation: `::`, e.g.
*
* ```sh
* $ pulumi import newrelic:index/alertPolicyChannel:AlertPolicyChannel foo 123456:3462754:2938324
* ```
*
* When importing `newrelic.AlertPolicyChannel` resource, the attribute `channelIds`\* will be set in your Terraform state. You can import multiple channels as long as those channel IDs are included as part of the import ID hash.
*/
export declare class AlertPolicyChannel extends pulumi.CustomResource {
/**
* Get an existing AlertPolicyChannel 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?: AlertPolicyChannelState, opts?: pulumi.CustomResourceOptions): AlertPolicyChannel;
/**
* Returns true if the given object is an instance of AlertPolicyChannel. 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 AlertPolicyChannel;
/**
* Determines the New Relic account where the alert policy channel will be created. Defaults to the account associated with the API key used.
*/
readonly accountId: pulumi.Output;
/**
* Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
*/
readonly channelIds: pulumi.Output;
/**
* The ID of the policy.
*/
readonly policyId: pulumi.Output;
/**
* Create a AlertPolicyChannel 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: AlertPolicyChannelArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering AlertPolicyChannel resources.
*/
export interface AlertPolicyChannelState {
/**
* Determines the New Relic account where the alert policy channel will be created. Defaults to the account associated with the API key used.
*/
accountId?: pulumi.Input;
/**
* Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
*/
channelIds?: pulumi.Input[] | undefined>;
/**
* The ID of the policy.
*/
policyId?: pulumi.Input;
}
/**
* The set of arguments for constructing a AlertPolicyChannel resource.
*/
export interface AlertPolicyChannelArgs {
/**
* Determines the New Relic account where the alert policy channel will be created. Defaults to the account associated with the API key used.
*/
accountId?: pulumi.Input;
/**
* Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
*/
channelIds: pulumi.Input[]>;
/**
* The ID of the policy.
*/
policyId: pulumi.Input;
}
//# sourceMappingURL=alertPolicyChannel.d.ts.map