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 insensitiveLabels.authToken(NOT inlabels)."pagerduty"—labels: {'service_name': 'prod-oncall'}. The integration service key goes insensitiveLabels.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 inlabels)."webhook_tokenauth"—labels: {'url': 'https://...'}+sensitiveLabels.authTokenfor 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< ? labels, MonitoringNotificationChannelSensitiveLabels? sensitiveLabels, TfArg<String, String> >Map< ? userLabels, TfArg<String, String> >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 aDependencyTarget— either a wholesale resource (rendered as bare address) or an explicitTfRef(rendered viabareAddress).finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
→ TfRef<
String> -
Reference to
idattribute.no setter - kind → ResourceKind
-
Always
ResourceKind.resource. Overridden byData.no setterinherited - lifecycle → LifecycleOptions?
-
Optional
lifecycle { ... }block.finalinherited - localName → String
-
User-supplied local name within a Stack.
finalinherited
-
nameRef
→ TfRef<
String> -
Reference to
nameattribute.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sensitiveFields
→ Set<
String> -
Field names that are
@Sensitiveper the IR-derived per-resource constant. Curated factories override with a baked-instatic 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_protectionboolean attribute that the synth-time devMode flow can flip tofalse. Defaults to false; the codegen emitter overrides this totruefor 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_statusattribute.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