newrelic logo
New Relic v5.7.0, Mar 23 23

newrelic.AlertPolicy

Use this resource to create and manage New Relic alert policies.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using NewRelic = Pulumi.NewRelic;

return await Deployment.RunAsync(() => 
{
    var foo = new NewRelic.AlertPolicy("foo", new()
    {
        IncidentPreference = "PER_POLICY",
    });

});
package main

import (
	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := newrelic.NewAlertPolicy(ctx, "foo", &newrelic.AlertPolicyArgs{
			IncidentPreference: pulumi.String("PER_POLICY"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.AlertPolicy;
import com.pulumi.newrelic.AlertPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var foo = new AlertPolicy("foo", AlertPolicyArgs.builder()        
            .incidentPreference("PER_POLICY")
            .build());

    }
}
import pulumi
import pulumi_newrelic as newrelic

foo = newrelic.AlertPolicy("foo", incident_preference="PER_POLICY")
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

const foo = new newrelic.AlertPolicy("foo", {incidentPreference: "PER_POLICY"});
resources:
  foo:
    type: newrelic:AlertPolicy
    properties:
      incidentPreference: PER_POLICY

Provision multiple notification channels and add those channels to a policy

using System.Collections.Generic;
using Pulumi;
using NewRelic = Pulumi.NewRelic;

return await Deployment.RunAsync(() => 
{
    // Provision a Slack notification channel.
    var slackChannel = new NewRelic.AlertChannel("slackChannel", new()
    {
        Type = "slack",
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Url = "https://hooks.slack.com/services/xxxxxxx/yyyyyyyy",
            Channel = "example-alerts-channel",
        },
    });

    // Provision an email notification channel.
    var emailChannel = new NewRelic.AlertChannel("emailChannel", new()
    {
        Type = "email",
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Recipients = "example@testing.com",
            IncludeJsonAttachment = "1",
        },
    });

    // Provision the alert policy.
    var policyWithChannels = new NewRelic.AlertPolicy("policyWithChannels", new()
    {
        IncidentPreference = "PER_CONDITION",
        ChannelIds = new[]
        {
            slackChannel.Id,
            emailChannel.Id,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		slackChannel, err := newrelic.NewAlertChannel(ctx, "slackChannel", &newrelic.AlertChannelArgs{
			Type: pulumi.String("slack"),
			Config: &newrelic.AlertChannelConfigArgs{
				Url:     pulumi.String("https://hooks.slack.com/services/xxxxxxx/yyyyyyyy"),
				Channel: pulumi.String("example-alerts-channel"),
			},
		})
		if err != nil {
			return err
		}
		emailChannel, err := newrelic.NewAlertChannel(ctx, "emailChannel", &newrelic.AlertChannelArgs{
			Type: pulumi.String("email"),
			Config: &newrelic.AlertChannelConfigArgs{
				Recipients:            pulumi.String("example@testing.com"),
				IncludeJsonAttachment: pulumi.String("1"),
			},
		})
		if err != nil {
			return err
		}
		_, err = newrelic.NewAlertPolicy(ctx, "policyWithChannels", &newrelic.AlertPolicyArgs{
			IncidentPreference: pulumi.String("PER_CONDITION"),
			ChannelIds: pulumi.IntArray{
				slackChannel.ID(),
				emailChannel.ID(),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.AlertChannel;
import com.pulumi.newrelic.AlertChannelArgs;
import com.pulumi.newrelic.inputs.AlertChannelConfigArgs;
import com.pulumi.newrelic.AlertPolicy;
import com.pulumi.newrelic.AlertPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var slackChannel = new AlertChannel("slackChannel", AlertChannelArgs.builder()        
            .type("slack")
            .config(AlertChannelConfigArgs.builder()
                .url("https://hooks.slack.com/services/xxxxxxx/yyyyyyyy")
                .channel("example-alerts-channel")
                .build())
            .build());

        var emailChannel = new AlertChannel("emailChannel", AlertChannelArgs.builder()        
            .type("email")
            .config(AlertChannelConfigArgs.builder()
                .recipients("example@testing.com")
                .includeJsonAttachment("1")
                .build())
            .build());

        var policyWithChannels = new AlertPolicy("policyWithChannels", AlertPolicyArgs.builder()        
            .incidentPreference("PER_CONDITION")
            .channelIds(            
                slackChannel.id(),
                emailChannel.id())
            .build());

    }
}
import pulumi
import pulumi_newrelic as newrelic

# Provision a Slack notification channel.
slack_channel = newrelic.AlertChannel("slackChannel",
    type="slack",
    config=newrelic.AlertChannelConfigArgs(
        url="https://hooks.slack.com/services/xxxxxxx/yyyyyyyy",
        channel="example-alerts-channel",
    ))
# Provision an email notification channel.
email_channel = newrelic.AlertChannel("emailChannel",
    type="email",
    config=newrelic.AlertChannelConfigArgs(
        recipients="example@testing.com",
        include_json_attachment="1",
    ))
# Provision the alert policy.
policy_with_channels = newrelic.AlertPolicy("policyWithChannels",
    incident_preference="PER_CONDITION",
    channel_ids=[
        slack_channel.id,
        email_channel.id,
    ])
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

// Provision a Slack notification channel.
const slackChannel = new newrelic.AlertChannel("slackChannel", {
    type: "slack",
    config: {
        url: "https://hooks.slack.com/services/xxxxxxx/yyyyyyyy",
        channel: "example-alerts-channel",
    },
});
// Provision an email notification channel.
const emailChannel = new newrelic.AlertChannel("emailChannel", {
    type: "email",
    config: {
        recipients: "example@testing.com",
        includeJsonAttachment: "1",
    },
});
// Provision the alert policy.
const policyWithChannels = new newrelic.AlertPolicy("policyWithChannels", {
    incidentPreference: "PER_CONDITION",
    channelIds: [
        slackChannel.id,
        emailChannel.id,
    ],
});
resources:
  # Provision a Slack notification channel.
  slackChannel:
    type: newrelic:AlertChannel
    properties:
      type: slack
      config:
        url: https://hooks.slack.com/services/xxxxxxx/yyyyyyyy
        channel: example-alerts-channel
  # Provision an email notification channel.
  emailChannel:
    type: newrelic:AlertChannel
    properties:
      type: email
      config:
        recipients: example@testing.com
        includeJsonAttachment: '1'
  # Provision the alert policy.
  policyWithChannels:
    type: newrelic:AlertPolicy
    properties:
      incidentPreference: PER_CONDITION
      # NOTE: The `channel_ids` argument has been deprecated. Avoid usage.
      #   # Add the provisioned channels to the policy.
      channelIds:
        - ${slackChannel.id}
        - ${emailChannel.id}

Reference existing notification channels and add those channel to a policy

using System.Collections.Generic;
using Pulumi;
using NewRelic = Pulumi.NewRelic;

return await Deployment.RunAsync(() => 
{
    var slackChannel = NewRelic.GetAlertChannel.Invoke(new()
    {
        Name = "slack-channel-notification",
    });

    var emailChannel = NewRelic.GetAlertChannel.Invoke(new()
    {
        Name = "test@example.com",
    });

    // Provision the alert policy.
    var policyWithChannels = new NewRelic.AlertPolicy("policyWithChannels", new()
    {
        IncidentPreference = "PER_CONDITION",
        ChannelIds = new[]
        {
            slackChannel.Apply(getAlertChannelResult => getAlertChannelResult.Id),
            emailChannel.Apply(getAlertChannelResult => getAlertChannelResult.Id),
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		slackChannel, err := newrelic.LookupAlertChannel(ctx, &newrelic.LookupAlertChannelArgs{
			Name: "slack-channel-notification",
		}, nil)
		if err != nil {
			return err
		}
		emailChannel, err := newrelic.LookupAlertChannel(ctx, &newrelic.LookupAlertChannelArgs{
			Name: "test@example.com",
		}, nil)
		if err != nil {
			return err
		}
		_, err = newrelic.NewAlertPolicy(ctx, "policyWithChannels", &newrelic.AlertPolicyArgs{
			IncidentPreference: pulumi.String("PER_CONDITION"),
			ChannelIds: pulumi.IntArray{
				*pulumi.String(slackChannel.Id),
				*pulumi.String(emailChannel.Id),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.NewrelicFunctions;
import com.pulumi.newrelic.inputs.GetAlertChannelArgs;
import com.pulumi.newrelic.AlertPolicy;
import com.pulumi.newrelic.AlertPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var slackChannel = NewrelicFunctions.getAlertChannel(GetAlertChannelArgs.builder()
            .name("slack-channel-notification")
            .build());

        final var emailChannel = NewrelicFunctions.getAlertChannel(GetAlertChannelArgs.builder()
            .name("test@example.com")
            .build());

        var policyWithChannels = new AlertPolicy("policyWithChannels", AlertPolicyArgs.builder()        
            .incidentPreference("PER_CONDITION")
            .channelIds(            
                slackChannel.applyValue(getAlertChannelResult -> getAlertChannelResult.id()),
                emailChannel.applyValue(getAlertChannelResult -> getAlertChannelResult.id()))
            .build());

    }
}
import pulumi
import pulumi_newrelic as newrelic

slack_channel = newrelic.get_alert_channel(name="slack-channel-notification")
email_channel = newrelic.get_alert_channel(name="test@example.com")
# Provision the alert policy.
policy_with_channels = newrelic.AlertPolicy("policyWithChannels",
    incident_preference="PER_CONDITION",
    channel_ids=[
        slack_channel.id,
        email_channel.id,
    ])
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

const slackChannel = newrelic.getAlertChannel({
    name: "slack-channel-notification",
});
const emailChannel = newrelic.getAlertChannel({
    name: "test@example.com",
});
// Provision the alert policy.
const policyWithChannels = new newrelic.AlertPolicy("policyWithChannels", {
    incidentPreference: "PER_CONDITION",
    channelIds: [
        slackChannel.then(slackChannel => slackChannel.id),
        emailChannel.then(emailChannel => emailChannel.id),
    ],
});
resources:
  # Provision the alert policy.
  policyWithChannels:
    type: newrelic:AlertPolicy
    properties:
      incidentPreference: PER_CONDITION
      # NOTE: The `channel_ids` argument has been deprecated. Avoid usage.
      #   # Add the referenced channels to the policy.
      channelIds:
        - ${slackChannel.id}
        - ${emailChannel.id}
variables:
  slackChannel:
    fn::invoke:
      Function: newrelic:getAlertChannel
      Arguments:
        name: slack-channel-notification
  emailChannel:
    fn::invoke:
      Function: newrelic:getAlertChannel
      Arguments:
        name: test@example.com

Create AlertPolicy Resource

new AlertPolicy(name: string, args?: AlertPolicyArgs, opts?: CustomResourceOptions);
@overload
def AlertPolicy(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                account_id: Optional[int] = None,
                channel_ids: Optional[Sequence[int]] = None,
                incident_preference: Optional[str] = None,
                name: Optional[str] = None)
@overload
def AlertPolicy(resource_name: str,
                args: Optional[AlertPolicyArgs] = None,
                opts: Optional[ResourceOptions] = None)
func NewAlertPolicy(ctx *Context, name string, args *AlertPolicyArgs, opts ...ResourceOption) (*AlertPolicy, error)
public AlertPolicy(string name, AlertPolicyArgs? args = null, CustomResourceOptions? opts = null)
public AlertPolicy(String name, AlertPolicyArgs args)
public AlertPolicy(String name, AlertPolicyArgs args, CustomResourceOptions options)
type: newrelic:AlertPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AlertPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args AlertPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AlertPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AlertPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AlertPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

AlertPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The AlertPolicy resource accepts the following input properties:

AccountId int

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

ChannelIds List<int>

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

IncidentPreference string

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

Name string

The name of the policy.

AccountId int

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

ChannelIds []int

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

IncidentPreference string

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

Name string

The name of the policy.

accountId Integer

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

channelIds List<Integer>

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

incidentPreference String

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

name String

The name of the policy.

accountId number

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

channelIds number[]

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

incidentPreference string

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

name string

The name of the policy.

account_id int

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

channel_ids Sequence[int]

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

incident_preference str

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

name str

The name of the policy.

accountId Number

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

channelIds List<Number>

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

incidentPreference String

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

name String

The name of the policy.

Outputs

All input properties are implicitly available as output properties. Additionally, the AlertPolicy 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 string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing AlertPolicy Resource

Get an existing AlertPolicy 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?: AlertPolicyState, opts?: CustomResourceOptions): AlertPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[int] = None,
        channel_ids: Optional[Sequence[int]] = None,
        incident_preference: Optional[str] = None,
        name: Optional[str] = None) -> AlertPolicy
func GetAlertPolicy(ctx *Context, name string, id IDInput, state *AlertPolicyState, opts ...ResourceOption) (*AlertPolicy, error)
public static AlertPolicy Get(string name, Input<string> id, AlertPolicyState? state, CustomResourceOptions? opts = null)
public static AlertPolicy get(String name, Output<String> id, AlertPolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
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:
AccountId int

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

ChannelIds List<int>

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

IncidentPreference string

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

Name string

The name of the policy.

AccountId int

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

ChannelIds []int

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

IncidentPreference string

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

Name string

The name of the policy.

accountId Integer

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

channelIds List<Integer>

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

incidentPreference String

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

name String

The name of the policy.

accountId number

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

channelIds number[]

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

incidentPreference string

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

name string

The name of the policy.

account_id int

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

channel_ids Sequence[int]

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

incident_preference str

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

name str

The name of the policy.

accountId Number

The New Relic account ID to operate on. This allows the user to override the account_id attribute set on the provider. Defaults to the environment variable NEW_RELIC_ACCOUNT_ID.

channelIds List<Number>

An array of channel IDs (integers) to assign to the policy. Adding or removing channel IDs from this array will result in a new alert policy resource being created and the old one being destroyed. Also note that channel IDs cannot be imported.

Deprecated:

The channel_ids attribute is deprecated and will be removed in the next major release of the provider.

incidentPreference String

The rollup strategy for the policy. Options include: PER_POLICY, PER_CONDITION, or PER_CONDITION_AND_TARGET. The default is PER_POLICY.

name String

The name of the policy.

Import

Alert policies can be imported using a composite ID of <id>:<account_id>, where account_id is the account number scoped to the alert policy resource. Example import

 $ pulumi import newrelic:index/alertPolicy:AlertPolicy foo 23423556:4593020

Please note that channel IDs (channel_ids) cannot be imported due channels being a separate resource. However, to add channels to an imported alert policy, you can import the policy, add the channel_ids attribute with the associated channel IDs, then run terraform apply. This will result in the original alert policy being destroyed and a new alert policy being created along with the channels being added to the policy.

Package Details

Repository
New Relic pulumi/pulumi-newrelic
License
Apache-2.0
Notes

This Pulumi package is based on the newrelic Terraform Provider.