AlertPolicyChannel
Use this resource to map alert policies to alert channels in New Relic.
Example Usage
using Pulumi;
using NewRelic = Pulumi.NewRelic;
class MyStack : Stack
{
public MyStack()
{
var examplePolicy = Output.Create(NewRelic.GetAlertPolicy.InvokeAsync(new NewRelic.GetAlertPolicyArgs
{
Name = "my-alert-policy",
}));
// Creates an email alert channel.
var emailChannel = new NewRelic.AlertChannel("emailChannel", new NewRelic.AlertChannelArgs
{
Type = "email",
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
Recipients = "foo@example.com",
IncludeJsonAttachment = "1",
},
});
// Creates a Slack alert channel.
var slackChannel = new NewRelic.AlertChannel("slackChannel", new NewRelic.AlertChannelArgs
{
Type = "slack",
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
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.
var foo = new NewRelic.AlertPolicyChannel("foo", new NewRelic.AlertPolicyChannelArgs
{
PolicyId = newrelic_alert_policy.Example_policy.Id,
ChannelIds =
{
emailChannel.Id,
slackChannel.Id,
},
});
}
}
Coming soon!
import pulumi
import pulumi_newrelic as newrelic
example_policy = newrelic.get_alert_policy(name="my-alert-policy")
# Creates an email alert channel.
email_channel = newrelic.AlertChannel("emailChannel",
type="email",
config={
"recipients": "foo@example.com",
"includeJsonAttachment": "1",
})
# Creates a Slack alert channel.
slack_channel = newrelic.AlertChannel("slackChannel",
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.
foo = newrelic.AlertPolicyChannel("foo",
policy_id=newrelic_alert_policy["example_policy"]["id"],
channel_ids=[
email_channel.id,
slack_channel.id,
])import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
const examplePolicy = newrelic.getAlertPolicy({
name: "my-alert-policy",
});
// Creates an email alert channel.
const emailChannel = new newrelic.AlertChannel("emailChannel", {
type: "email",
config: {
recipients: "foo@example.com",
includeJsonAttachment: "1",
},
});
// Creates a Slack alert channel.
const slackChannel = new newrelic.AlertChannel("slackChannel", {
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: newrelic_alert_policy.example_policy.id,
channelIds: [
emailChannel.id,
slackChannel.id,
],
});Create a AlertPolicyChannel Resource
new AlertPolicyChannel(name: string, args: AlertPolicyChannelArgs, opts?: CustomResourceOptions);def AlertPolicyChannel(resource_name, opts=None, channel_ids=None, policy_id=None, __props__=None);func NewAlertPolicyChannel(ctx *Context, name string, args AlertPolicyChannelArgs, opts ...ResourceOption) (*AlertPolicyChannel, error)public AlertPolicyChannel(string name, AlertPolicyChannelArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args AlertPolicyChannelArgs
- 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 AlertPolicyChannelArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AlertPolicyChannelArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
AlertPolicyChannel Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The AlertPolicyChannel resource accepts the following input properties:
- Channel
Ids List<int> Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
- Policy
Id int The ID of the policy.
- Channel
Ids []int Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
- Policy
Id int The ID of the policy.
- channel
Ids number[] Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
- policy
Id number The ID of the policy.
- channel_
ids List[Integer] Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
- policy_
id float The ID of the policy.
Outputs
All input properties are implicitly available as output properties. Additionally, the AlertPolicyChannel resource produces the following output properties:
Look up an Existing AlertPolicyChannel Resource
Get an existing AlertPolicyChannel 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?: AlertPolicyChannelState, opts?: CustomResourceOptions): AlertPolicyChannelstatic get(resource_name, id, opts=None, channel_ids=None, policy_id=None, __props__=None);func GetAlertPolicyChannel(ctx *Context, name string, id IDInput, state *AlertPolicyChannelState, opts ...ResourceOption) (*AlertPolicyChannel, error)public static AlertPolicyChannel Get(string name, Input<string> id, AlertPolicyChannelState? 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:
- Channel
Ids List<int> Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
- Policy
Id int The ID of the policy.
- Channel
Ids []int Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
- Policy
Id int The ID of the policy.
- channel
Ids number[] Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
- policy
Id number The ID of the policy.
- channel_
ids List[Integer] Array of channel IDs to apply to the specified policy. We recommended sorting channel IDs in ascending order to avoid drift your Terraform state.
- policy_
id float The ID of the policy.
Package Details
- Repository
- https://github.com/pulumi/pulumi-newrelic
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
newrelicTerraform Provider.