GoogleMonitoringNotificationChannel class final

Factory wrapper for 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.

type is the notification channel type registry key. Google maintains the canonical list server-side (the API returns it from projects.notificationChannelDescriptors.list) and adds new transports asynchronously, so this slot is intentionally a free-form String rather than a Dart enum — pinning an enum here would force a terradart release every time Google ships a new descriptor.

Common type values and the channel-specific keys they expect in labels (the canonical reference is the NotificationChannelDescriptor for each type):

  • "email"labels: {'email_address': 'oncall@example.com'}.
  • "slack"labels: {'channel_name': '#alerts', 'team': 'T01234ABCD'}. The bot OAuth token goes in sensitiveLabels.authToken (NOT in labels).
  • "pagerduty"labels: {'service_name': 'prod-oncall'}. The integration service key goes in sensitiveLabels.serviceKey.
  • "sms"labels: {'number': '+15551234567'} (E.164 format, pre-verified phone numbers only).
  • "webhook_basicauth"labels: {'url': 'https://...'} + sensitiveLabels.password (with the basic-auth username embedded in the URL or in labels).
  • "webhook_tokenauth"labels: {'url': 'https://...'} + sensitiveLabels.authToken for the bearer token.
  • "pubsub"labels: {'topic': 'projects/<p>/topics/<t>'}. The service account that posts to the topic is managed via IAM, not via this resource.

Credentials handling: any value containing a secret (Slack token, PagerDuty service key, webhook auth token / basic-auth password) MUST be placed in sensitiveLabels rather than labels. The provider rejects configurations that supply the same logical secret in both places, and only sensitiveLabels entries are masked from plan output. The 3 plaintext slots (authToken, password, serviceKey) are flagged sensitive by the provider schema and also enumerated in extraSensitiveFields (belt-and-suspenders); the 6 write-only-API siblings (*_wo + *_wo_version) keep the plaintext out of Terraform state entirely on Terraform 1.11+ — prefer them when your CLI version supports it, bumping the *_wo_version int to force rotation.

Verification: verificationStatus reflects whether the channel has passed Google's out-of-band verification step (e.g. clicking a link in a confirmation email, replying to an SMS). Channels in the UNVERIFIED state do not deliver notifications. Verification cannot be triggered through this resource — call gcloud alpha monitoring channels verify or the projects.notificationChannels.verify REST endpoint after apply.

Example (Slack channel):

final slack = GoogleMonitoringNotificationChannel(
  localName: 'oncall_slack',
  displayName: TfArg.literal('#oncall alerts'),
  type: TfArg.literal('slack'),
  labels: TfArg.literal(const {
    'channel_name': '#oncall',
    'team': 'T01234ABCD',
  }),
  sensitiveLabels: MonitoringNotificationChannelSensitiveLabels(
    authTokenWo: TfArg.ref(slackBotTokenSecret.versionRef),
    authTokenWoVersion: TfArg.literal('1'),
  ),
  userLabels: TfArg.literal(const {'team': 'platform'}),
);

Constructors

GoogleMonitoringNotificationChannel({required String localName, TfArg<String>? displayName, required TfArg<String> type, TfArg<Map<String, String>>? labels, MonitoringNotificationChannelSensitiveLabels? sensitiveLabels, TfArg<Map<String, String>>? userLabels, TfArg<String>? description, TfArg<bool>? enabled, TfArg<bool>? forceDelete, TfArg<String>? project, LifecycleOptions? lifecycle, List<DependencyTarget>? dependsOn})

Properties

argMap Map<String, TfArg?>
Argument-name → TfArg map. Keys are snake_case (Terraform JSON name). Synth emits these keys directly; the factory is responsible for the camelCase → snake_case translation at construction time.
finalinherited
dependsOn List<DependencyTarget>?
Optional depends_on = [...]. Each entry is a DependencyTarget — either a wholesale resource (rendered as bare address) or an explicit TfRef (rendered via bareAddress).
finalinherited
hashCode int
The hash code for this object.
no setterinherited
id → TfRef<String>
Reference to id attribute.
no setter
kind → ResourceKind
Always ResourceKind.resource. Overridden by Data.
no setterinherited
lifecycle → LifecycleOptions?
Optional lifecycle { ... } block.
finalinherited
localName String
User-supplied local name within a Stack.
finalinherited
nameRef → TfRef<String>
Reference to name attribute.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sensitiveFields Set<String>
Field names that are @Sensitive per the IR-derived per-resource constant. Curated factories override with a baked-in static const Set<String> (file-private in v0.5+).
no setter
supportsDeletionProtection bool
Capability flag: true when this resource's underlying Terraform schema has a deletion_protection boolean attribute that the synth-time devMode flow can flip to false. Defaults to false; the codegen emitter overrides this to true for wrappers whose schema includes the attribute.
no setterinherited
terraformType String
Terraform resource type, e.g. google_pubsub_topic.
finalinherited
tfAddress String
no setterinherited
verificationStatus → TfRef<String>
Reference to verification_status attribute.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

tfType → const String