Set up automated notification

  • Latest Dynatrace
  • Tutorial
  • 2-min read
  • Published Jul 22, 2025

This tutorial explains how configure an event notification with the latest Dynatrace. The notification consists of

  • An Davis anomaly detector configuration, which raises an alerting event if a certain conditions is met.
  • A simple workflow that automatically sends an email when the alerting event is active.

Prerequisites

  • Terraform CLI with the Dynatrace provider installed and available under PATH. For more information, see Install Terraform.

  • OAuth client or platform token with the following permissions. For more information, see Create API access token.

    • View settings objects for schema (settings:objects:read)
    • Create settings objects for schema (settings:objects:write)
    • View workflows (automation:workflows:read)
    • Create and edit workflows (automation:workflows:write)

    The Terraform user needs to have all required permissions to run the run automated configurations such as davis anomaly detectors or workflows. Missing or wrong permission can lead to an unexpected behavior.

What will you learn

You'll learn how to configure an anomaly detector and a workflow with an email action.

Steps

To build a configuration for raising an event and a simple workflow for sending an email in case of a raised event

  1. Inside your working directory, create a main.tf file with the content for selected resources.

This file contains the Terraform configuration—a set of resource blocks that define the configuration.

If you want to try other resources, consider using the export utility to export existing configurations from your selected environment.

  1. Open a terminal and set the environment variables for your environment URL and authentication credentials. The environment variable identifies which tenant you'll be pushing configurations to. For more information, see Terraform API support and access permission handling.

  2. In your working directory, run the terraform plan to generate an execution plan that provides a preview of the changes Terraform intends to make.

  1. After verifying the plan, execute terraform apply to implement the proposed changes.

    dynatrace_automation_workflow.Authentication_Service_Email_Notification: Creating...
    dynatrace_davis_anomaly_detectors.Authentication_Service_High_Response_Time: Creating...
    dynatrace_davis_anomaly_detectors.Authentication_Service_High_Response_Time: Creation complete after 2s [id=************]
    dynatrace_automation_workflow.Authentication_Service_Email_Notification: Creation complete after 5s [id=************]
    Apply complete! Resources: 2 added, 0 changed, 0 destroyed.

    A Terraform terraform.tfstate state file is automatically generated. It keeps track of the resources that Terraform manages. It's crucial for subsequent Terraform operations.

To modify the Terraform configuration

  1. Execute the terraform plan, which should indicate that no changes are needed.

    dynatrace_automation_workflow.Authentication_Service_Email_Notification: Refreshing state... [id=************]
    dynatrace_davis_anomaly_detectors.Authentication_Service_High_Response_Time: Refreshing state... [id=************]
    No changes. Your infrastructure matches the configuration.
    Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
  2. To make a change, edit the main.tf file. For instance, you can modify the email notification recipient by modifying the to attribute in the dynatrace_davis_anomaly_detectors resource.

dynatrace_automation_workflow.Authentication_Service_Email_Notification: Refreshing state... [id=************]
dynatrace_davis_anomaly_detectors.Authentication_Service_High_Response_Time: Refreshing state... [id=************]
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
+1 more
  1. To remove a configuration, run terraform plan to confirm no pending changes.

    dynatrace_automation_workflow.Authentication_Service_Email_Notification: Refreshing state... [id=************]
    dynatrace_davis_anomaly_detectors.Authentication_Service_High_Response_Time: Refreshing state... [id=************]
    No changes. Your infrastructure matches the configuration.
    Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
  2. To permanently delete the selected configuration, execute terraform destroy.

    dynatrace_davis_anomaly_detectors.Authentication_Service_High_Response_Time: Destroying... [id= ************]
    dynatrace_automation_workflow.Authentication_Service_Email_Notification: Destroying... [id= ************]
    dynatrace_davis_anomaly_detectors.Authentication_Service_High_Response_Time: Destruction complete after 0s
    dynatrace_automation_workflow.Authentication_Service_Email_Notification: Destruction complete after 1s
    Destroy complete! Resources: 2 destroyed.

    The previously created configurations in the Dynatrace environment have been destroyed. Confirm that your Terraform state terraform.tfstate file is empty.

Related tags
Software DeliveryDynatrace Platform