NotificationChannelArgs

data class NotificationChannelArgs(val description: Output<String>? = null, val displayName: Output<String>? = null, val enabled: Output<Boolean>? = null, val forceDelete: Output<Boolean>? = null, val labels: Output<Map<String, String>>? = null, val project: Output<String>? = null, val sensitiveLabels: Output<NotificationChannelSensitiveLabelsArgs>? = null, val type: Output<String>? = null, val userLabels: Output<Map<String, String>>? = null) : ConvertibleToJava<NotificationChannelArgs>

A NotificationChannel is a medium through which an alert is delivered when a policy violation is detected. Examples of channels include email, SMS, and third-party messaging applications. Fields containing sensitive information like authentication tokens or contact info are only partially populated on retrieval. Notification Channels are designed to be flexible and are made up of a supported type and labels to configure that channel. Each type has specific labels that need to be present for that channel to be correctly configured. The labels that are required to be present for one channel type are often different than those required for another. Due to these loose constraints it's often best to set up a channel through the UI and import it to the provider when setting up a brand new channel type to determine which labels are required. A list of supported channels per project the list endpoint can be accessed programmatically or through the api explorer at https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.notificationChannelDescriptors/list . This provides the channel type and all of the required labels that must be passed. To get more information about NotificationChannel, see:

Example Usage

Notification Channel Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const basic = new gcp.monitoring.NotificationChannel("basic", {
displayName: "Test Notification Channel",
type: "email",
labels: {
email_address: "fake_email@blahblah.com",
},
forceDelete: false,
});
import pulumi
import pulumi_gcp as gcp
basic = gcp.monitoring.NotificationChannel("basic",
display_name="Test Notification Channel",
type="email",
labels={
"email_address": "fake_email@blahblah.com",
},
force_delete=False)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var basic = new Gcp.Monitoring.NotificationChannel("basic", new()
{
DisplayName = "Test Notification Channel",
Type = "email",
Labels =
{
{ "email_address", "fake_email@blahblah.com" },
},
ForceDelete = false,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/monitoring"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := monitoring.NewNotificationChannel(ctx, "basic", &monitoring.NotificationChannelArgs{
DisplayName: pulumi.String("Test Notification Channel"),
Type: pulumi.String("email"),
Labels: pulumi.StringMap{
"email_address": pulumi.String("fake_email@blahblah.com"),
},
ForceDelete: pulumi.Bool(false),
})
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.gcp.monitoring.NotificationChannel;
import com.pulumi.gcp.monitoring.NotificationChannelArgs;
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 basic = new NotificationChannel("basic", NotificationChannelArgs.builder()
.displayName("Test Notification Channel")
.type("email")
.labels(Map.of("email_address", "fake_email@blahblah.com"))
.forceDelete(false)
.build());
}
}
resources:
basic:
type: gcp:monitoring:NotificationChannel
properties:
displayName: Test Notification Channel
type: email
labels:
email_address: fake_email@blahblah.com
forceDelete: false

Notification Channel Sensitive

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const _default = new gcp.monitoring.NotificationChannel("default", {
displayName: "Test Slack Channel",
type: "slack",
labels: {
channel_name: "#foobar",
},
sensitiveLabels: {
authToken: "one",
},
});
import pulumi
import pulumi_gcp as gcp
default = gcp.monitoring.NotificationChannel("default",
display_name="Test Slack Channel",
type="slack",
labels={
"channel_name": "#foobar",
},
sensitive_labels={
"auth_token": "one",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = new Gcp.Monitoring.NotificationChannel("default", new()
{
DisplayName = "Test Slack Channel",
Type = "slack",
Labels =
{
{ "channel_name", "#foobar" },
},
SensitiveLabels = new Gcp.Monitoring.Inputs.NotificationChannelSensitiveLabelsArgs
{
AuthToken = "one",
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/monitoring"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := monitoring.NewNotificationChannel(ctx, "default", &monitoring.NotificationChannelArgs{
DisplayName: pulumi.String("Test Slack Channel"),
Type: pulumi.String("slack"),
Labels: pulumi.StringMap{
"channel_name": pulumi.String("#foobar"),
},
SensitiveLabels: &monitoring.NotificationChannelSensitiveLabelsArgs{
AuthToken: pulumi.String("one"),
},
})
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.gcp.monitoring.NotificationChannel;
import com.pulumi.gcp.monitoring.NotificationChannelArgs;
import com.pulumi.gcp.monitoring.inputs.NotificationChannelSensitiveLabelsArgs;
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 default_ = new NotificationChannel("default", NotificationChannelArgs.builder()
.displayName("Test Slack Channel")
.type("slack")
.labels(Map.of("channel_name", "#foobar"))
.sensitiveLabels(NotificationChannelSensitiveLabelsArgs.builder()
.authToken("one")
.build())
.build());
}
}
resources:
default:
type: gcp:monitoring:NotificationChannel
properties:
displayName: Test Slack Channel
type: slack
labels:
channel_name: '#foobar'
sensitiveLabels:
authToken: one

Import

NotificationChannel can be imported using any of these accepted formats:

  • {{name}} When using the pulumi import command, NotificationChannel can be imported using one of the formats above. For example:

$ pulumi import gcp:monitoring/notificationChannel:NotificationChannel default {{name}}

Constructors

Link copied to clipboard
constructor(description: Output<String>? = null, displayName: Output<String>? = null, enabled: Output<Boolean>? = null, forceDelete: Output<Boolean>? = null, labels: Output<Map<String, String>>? = null, project: Output<String>? = null, sensitiveLabels: Output<NotificationChannelSensitiveLabelsArgs>? = null, type: Output<String>? = null, userLabels: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val description: Output<String>? = null

An optional human-readable description of this notification channel. This description may provide additional details, beyond the display name, for the channel. This may not exceed 1024 Unicode characters.

Link copied to clipboard
val displayName: Output<String>? = null

An optional human-readable name for this notification channel. It is recommended that you specify a non-empty and unique name in order to make it easier to identify the channels in your project, though this is not enforced. The display name is limited to 512 Unicode characters.

Link copied to clipboard
val enabled: Output<Boolean>? = null

Whether notifications are forwarded to the described channel. This makes it possible to disable delivery of notifications to a particular channel without removing the channel from all alerting policies that reference the channel. This is a more convenient approach when the change is temporary and you want to receive notifications from the same set of alerting policies on the channel at some point in the future.

Link copied to clipboard
val forceDelete: Output<Boolean>? = null

If true, the notification channel will be deleted regardless of its use in alert policies (the policies will be updated to remove the channel). If false, channels that are still referenced by an existing alerting policy will fail to be deleted in a delete operation.

Link copied to clipboard
val labels: Output<Map<String, String>>? = null

Configuration fields that define the channel and its behavior. The permissible and required labels are specified in the NotificationChannelDescriptor corresponding to the type field. Labels with sensitive data are obfuscated by the API and therefore the provider cannot determine if there are upstream changes to these fields. They can also be configured via the sensitive_labels block, but cannot be configured in both places.

Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard

Different notification type behaviors are configured primarily using the the labels field on this resource. This block contains the labels which contain secrets or passwords so that they can be marked sensitive and hidden from plan output. The name of the field, eg: password, will be the key in the labels map in the api request. Credentials may not be specified in both locations and will cause an error. Changing from one location to a different credential configuration in the config will require an apply to update state. Structure is documented below.

Link copied to clipboard
val type: Output<String>? = null

The type of the notification channel. This field matches the value of the NotificationChannelDescriptor.type field. See https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.notificationChannelDescriptors/list to get the list of valid values such as "email", "slack", etc...

Link copied to clipboard
val userLabels: Output<Map<String, String>>? = null

User-supplied key/value data that does not need to conform to the corresponding NotificationChannelDescriptor's schema, unlike the labels field. This field is intended to be used for organizing and identifying the NotificationChannel objects.The field can contain up to 64 entries. Each key and value is limited to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values can contain only lowercase letters, numerals, underscores, and dashes. Keys must begin with a letter.

Functions

Link copied to clipboard
open override fun toJava(): NotificationChannelArgs