Use this data source to get information about a specific alert channel in New Relic that already exists.
WARNING: The
newrelic.AlertChanneldata source is deprecated and will be removed in the next major release.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";
// Data source
const foo = newrelic.getAlertChannel({
name: "foo@example.com",
});
// Resource
const fooAlertPolicy = new newrelic.AlertPolicy("foo", {name: "foo"});
// Using the data source and resource together
const fooAlertPolicyChannel = new newrelic.AlertPolicyChannel("foo", {
policyId: fooAlertPolicy.id,
channelId: foo.then(foo => foo.id),
});
import pulumi
import pulumi_newrelic as newrelic
# Data source
foo = newrelic.get_alert_channel(name="foo@example.com")
# Resource
foo_alert_policy = newrelic.AlertPolicy("foo", name="foo")
# Using the data source and resource together
foo_alert_policy_channel = newrelic.AlertPolicyChannel("foo",
policy_id=foo_alert_policy.id,
channel_id=foo.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 {
// Data source
foo, err := newrelic.LookupAlertChannel(ctx, &newrelic.LookupAlertChannelArgs{
Name: "foo@example.com",
}, nil)
if err != nil {
return err
}
// Resource
fooAlertPolicy, err := newrelic.NewAlertPolicy(ctx, "foo", &newrelic.AlertPolicyArgs{
Name: pulumi.String("foo"),
})
if err != nil {
return err
}
// Using the data source and resource together
_, err = newrelic.NewAlertPolicyChannel(ctx, "foo", &newrelic.AlertPolicyChannelArgs{
PolicyId: fooAlertPolicy.ID(),
ChannelId: foo.Id,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;
return await Deployment.RunAsync(() =>
{
// Data source
var foo = NewRelic.GetAlertChannel.Invoke(new()
{
Name = "foo@example.com",
});
// Resource
var fooAlertPolicy = new NewRelic.AlertPolicy("foo", new()
{
Name = "foo",
});
// Using the data source and resource together
var fooAlertPolicyChannel = new NewRelic.AlertPolicyChannel("foo", new()
{
PolicyId = fooAlertPolicy.Id,
ChannelId = foo.Apply(getAlertChannelResult => getAlertChannelResult.Id),
});
});
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 com.pulumi.newrelic.AlertPolicyChannel;
import com.pulumi.newrelic.AlertPolicyChannelArgs;
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) {
// Data source
final var foo = NewrelicFunctions.getAlertChannel(GetAlertChannelArgs.builder()
.name("foo@example.com")
.build());
// Resource
var fooAlertPolicy = new AlertPolicy("fooAlertPolicy", AlertPolicyArgs.builder()
.name("foo")
.build());
// Using the data source and resource together
var fooAlertPolicyChannel = new AlertPolicyChannel("fooAlertPolicyChannel", AlertPolicyChannelArgs.builder()
.policyId(fooAlertPolicy.id())
.channelId(foo.id())
.build());
}
}
resources:
# Resource
fooAlertPolicy:
type: newrelic:AlertPolicy
name: foo
properties:
name: foo
# Using the data source and resource together
fooAlertPolicyChannel:
type: newrelic:AlertPolicyChannel
name: foo
properties:
policyId: ${fooAlertPolicy.id}
channelId: ${foo.id}
variables:
# Data source
foo:
fn::invoke:
function: newrelic:getAlertChannel
arguments:
name: foo@example.com
Using getAlertChannel
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getAlertChannel(args: GetAlertChannelArgs, opts?: InvokeOptions): Promise<GetAlertChannelResult>
function getAlertChannelOutput(args: GetAlertChannelOutputArgs, opts?: InvokeOptions): Output<GetAlertChannelResult>def get_alert_channel(account_id: Optional[str] = None,
name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAlertChannelResult
def get_alert_channel_output(account_id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAlertChannelResult]func LookupAlertChannel(ctx *Context, args *LookupAlertChannelArgs, opts ...InvokeOption) (*LookupAlertChannelResult, error)
func LookupAlertChannelOutput(ctx *Context, args *LookupAlertChannelOutputArgs, opts ...InvokeOption) LookupAlertChannelResultOutput> Note: This function is named LookupAlertChannel in the Go SDK.
public static class GetAlertChannel
{
public static Task<GetAlertChannelResult> InvokeAsync(GetAlertChannelArgs args, InvokeOptions? opts = null)
public static Output<GetAlertChannelResult> Invoke(GetAlertChannelInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetAlertChannelResult> getAlertChannel(GetAlertChannelArgs args, InvokeOptions options)
public static Output<GetAlertChannelResult> getAlertChannel(GetAlertChannelArgs args, InvokeOptions options)
fn::invoke:
function: newrelic:index/getAlertChannel:getAlertChannel
arguments:
# arguments dictionaryThe following arguments are supported:
- name str
- The name of the alert channel in New Relic.
- account_
id str - The New Relic account ID to operate on. This allows you to override the
account_idattribute set on the provider. Defaults to the environment variableNEW_RELIC_ACCOUNT_ID.
getAlertChannel Result
The following output properties are available:
- Account
Id string - Config
Pulumi.
New Relic. Outputs. Get Alert Channel Config - Alert channel configuration.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Policy
Ids List<string> - A list of policy IDs associated with the alert channel.
- Type string
- Alert channel type, either:
email,opsgenie,pagerduty,slack,victorops, orwebhook.
- Account
Id string - Config
Get
Alert Channel Config - Alert channel configuration.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Policy
Ids []string - A list of policy IDs associated with the alert channel.
- Type string
- Alert channel type, either:
email,opsgenie,pagerduty,slack,victorops, orwebhook.
- account
Id String - config
Get
Alert Channel Config - Alert channel configuration.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- policy
Ids List<String> - A list of policy IDs associated with the alert channel.
- type String
- Alert channel type, either:
email,opsgenie,pagerduty,slack,victorops, orwebhook.
- account
Id string - config
Get
Alert Channel Config - Alert channel configuration.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- policy
Ids string[] - A list of policy IDs associated with the alert channel.
- type string
- Alert channel type, either:
email,opsgenie,pagerduty,slack,victorops, orwebhook.
- account_
id str - config
Get
Alert Channel Config - Alert channel configuration.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- policy_
ids Sequence[str] - A list of policy IDs associated with the alert channel.
- type str
- Alert channel type, either:
email,opsgenie,pagerduty,slack,victorops, orwebhook.
- account
Id String - config Property Map
- Alert channel configuration.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- policy
Ids List<String> - A list of policy IDs associated with the alert channel.
- type String
- Alert channel type, either:
email,opsgenie,pagerduty,slack,victorops, orwebhook.
Supporting Types
GetAlertChannelConfig
- Api
Key string - Auth
Password string - Auth
Type string - Auth
Username string - Base
Url string - Channel string
- Headers Dictionary<string, string>
- Include
Json stringAttachment - Key string
- Payload Dictionary<string, string>
- Payload
String string - Payload
Type string - Recipients string
- Region string
- Route
Key string - Service
Key string - string
- Teams string
- Url string
- User
Id string
- Api
Key string - Auth
Password string - Auth
Type string - Auth
Username string - Base
Url string - Channel string
- Headers map[string]string
- Include
Json stringAttachment - Key string
- Payload map[string]string
- Payload
String string - Payload
Type string - Recipients string
- Region string
- Route
Key string - Service
Key string - string
- Teams string
- Url string
- User
Id string
- api
Key String - auth
Password String - auth
Type String - auth
Username String - base
Url String - channel String
- headers Map<String,String>
- include
Json StringAttachment - key String
- payload Map<String,String>
- payload
String String - payload
Type String - recipients String
- region String
- route
Key String - service
Key String - String
- teams String
- url String
- user
Id String
- api
Key string - auth
Password string - auth
Type string - auth
Username string - base
Url string - channel string
- headers {[key: string]: string}
- include
Json stringAttachment - key string
- payload {[key: string]: string}
- payload
String string - payload
Type string - recipients string
- region string
- route
Key string - service
Key string - string
- teams string
- url string
- user
Id string
- api_
key str - auth_
password str - auth_
type str - auth_
username str - base_
url str - channel str
- headers Mapping[str, str]
- include_
json_ strattachment - key str
- payload Mapping[str, str]
- payload_
string str - payload_
type str - recipients str
- region str
- route_
key str - service_
key str - str
- teams str
- url str
- user_
id str
- api
Key String - auth
Password String - auth
Type String - auth
Username String - base
Url String - channel String
- headers Map<String>
- include
Json StringAttachment - key String
- payload Map<String>
- payload
String String - payload
Type String - recipients String
- region String
- route
Key String - service
Key String - String
- teams String
- url String
- user
Id String
Package Details
- Repository
- New Relic pulumi/pulumi-newrelic
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
newrelicTerraform Provider.
