google_monitoring_notification_channel

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 to Terraform 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:

Open in Cloud Shell

Example Usage - Notification Channel Basic

resource "google_monitoring_notification_channel" "basic" {
  display_name = "Test Notification Channel"
  type         = "email"
  labels = {
    email_address = "fake_email@blahblah.com"
  }
  force_delete = false
}

Example Usage - Notification Channel Sensitive

resource "google_monitoring_notification_channel" "default" {
  display_name = "Test Slack Channel"
  type         = "slack"
  labels = {
    "channel_name" = "#foobar"
  }
  sensitive_labels {
    auth_token = "one"
  }
}

Argument Reference

The following arguments are supported:


The sensitive_labels block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

NotificationChannel can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import NotificationChannel using one of the formats above. For example:

import {
  id = "{{name}}"
  to = google_monitoring_notification_channel.default
}

When using the terraform import command, NotificationChannel can be imported using one of the formats above. For example:

$ terraform import google_monitoring_notification_channel.default {{name}}

User Project Overrides

This resource supports User Project Overrides.