<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Error on trying to publish a new workflow using Terraform and Dynatrace API in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/Error-on-trying-to-publish-a-new-workflow-using-Terraform-and/m-p/304746#M2739</link>
    <description>&lt;P data-unlink="true"&gt;&lt;SPAN&gt;I am trying to publish a manually exported working Dynatrace JSON workflow as a Terraform file in a Github pipeline and it fails to be published via Dynatrace POST https://{environmentid}.apps.dynatrace.com/platform/automation/v1/workflows?adminAccess=true&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The Terraform config:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# dynatrace_automation_workflow.this["Custom workflow"] will be created
  resource "dynatrace_automation_workflow" "this" {
      description = "Custom workflow"
      id          = (known after apply)
      owner       = "GUID"
      private     = false
      title       = "Custom workflow"
      type        = "STANDARD"
      tasks {
          task {
              action      = "dynatrace.automations:execute-dql-query"
              active      = true
              description = "Task 1"
              input       = jsonencode(
                    {
                      query = &amp;lt;&amp;lt;-EOT
                            timeseries {...},
                            by: {...},
                            filter: {...},
                            from: "{{ event()['event.start'] }}",
                            to:   now()
                        EOT
                    }
                )
              name        = "task1"
                # (4 unchanged attributes hidden)
              conditions {
                  else   = "STOP"
                    # (1 unchanged attribute hidden)
                }
              position {
                  x = -1
                  y = 1
                }
            }
          task {
              action      = "dynatrace.automations:execute-dql-query"
              active      = true
              description = "Task 2"
              input       = jsonencode(
                    {
                      query = &amp;lt;&amp;lt;-EOT
                            timeseries sum(test.results, scalar: true),
                            by: {...},
                            filter: { run_id == "{{ result('task1').records[0].runId }}"
                            },
                            from: "{{ event()['event.start'] }}",
                            to:   now()
                        EOT
                    }
                )
              name        = "task2"
                # (4 unchanged attributes hidden)
              conditions {
                  custom = "{{ result('task1').records | length &amp;gt; 0 }}"
                  else   = "STOP"
                  states = {
                      "task1" = "SUCCESS"
                    }
                }
              position {
                  x = 1
                  y = 2
                }
            }
          task {
              action      = "dynatrace.msteams:send-message"
              active      = true
              description = "Task 3"
              input       = jsonencode(
                    {
                      connectionId  = "ConnectionID"
                      message       = jsonencode({...})
                    }
                )
              name        = "task3"
                # (4 unchanged attributes hidden)
              conditions {
                  custom = "{{ result('task1').records | length &amp;gt; 0 }}"
                  else   = "STOP"
                  states = {
                      "task1" = "SUCCESS"
                      "task2"   = "SUCCESS"
                    }
                }
              position {
                  x = 0
                  y = 3
                }
            }
        }
      trigger {
          event {
              active = true
              config {
                  davis_problem {
                      custom_filter     = "custom_filter"
                      entity_tags_match = "all"
                      on_problem_close  = false
                      categories {
                          availability           = false
                          custom                 = true
                          error                  = false
                          info                   = false
                          monitoring_unavailable = false
                          resource               = false
                          slowdown               = false
                        }
                    }
                }
            }
        }
    }&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;The&amp;nbsp;&lt;SPAN&gt;request is:&lt;BR /&gt;POST https://{environmentid}.apps.dynatrace.com/platform/automation/v1/workflows?adminAccess=true&lt;BR /&gt;The response is HTTP 400:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "error": {
    "message": "Invalid request.",
    "code": 400,
    "details": {
      "trigger": {
        "eventTrigger": "Error occurred when creating Event Trigger. Reason: custom_filter isn't allowed here."
      }
    }
  }
}&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;It seems that the issue has to do with the event filter defined here:&amp;nbsp;&lt;STRONG&gt;custom_filter = "custom_filter"&lt;/STRONG&gt;, but why can't I create a workflow with a custom event that perfectly works in a similar workflow created manually?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;Does anybody know what I can do to resolve the issue? Is there a way to export a custom alert and then create it in a JSON or Terraform via Dynatrace API?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2026 14:46:59 GMT</pubDate>
    <dc:creator>cometa</dc:creator>
    <dc:date>2026-09-24T14:46:59Z</dc:date>
    <item>
      <title>Error on trying to publish a new workflow using Terraform and Dynatrace API</title>
      <link>https://community.dynatrace.com/t5/Automations/Error-on-trying-to-publish-a-new-workflow-using-Terraform-and/m-p/304746#M2739</link>
      <description>&lt;P data-unlink="true"&gt;&lt;SPAN&gt;I am trying to publish a manually exported working Dynatrace JSON workflow as a Terraform file in a Github pipeline and it fails to be published via Dynatrace POST https://{environmentid}.apps.dynatrace.com/platform/automation/v1/workflows?adminAccess=true&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The Terraform config:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# dynatrace_automation_workflow.this["Custom workflow"] will be created
  resource "dynatrace_automation_workflow" "this" {
      description = "Custom workflow"
      id          = (known after apply)
      owner       = "GUID"
      private     = false
      title       = "Custom workflow"
      type        = "STANDARD"
      tasks {
          task {
              action      = "dynatrace.automations:execute-dql-query"
              active      = true
              description = "Task 1"
              input       = jsonencode(
                    {
                      query = &amp;lt;&amp;lt;-EOT
                            timeseries {...},
                            by: {...},
                            filter: {...},
                            from: "{{ event()['event.start'] }}",
                            to:   now()
                        EOT
                    }
                )
              name        = "task1"
                # (4 unchanged attributes hidden)
              conditions {
                  else   = "STOP"
                    # (1 unchanged attribute hidden)
                }
              position {
                  x = -1
                  y = 1
                }
            }
          task {
              action      = "dynatrace.automations:execute-dql-query"
              active      = true
              description = "Task 2"
              input       = jsonencode(
                    {
                      query = &amp;lt;&amp;lt;-EOT
                            timeseries sum(test.results, scalar: true),
                            by: {...},
                            filter: { run_id == "{{ result('task1').records[0].runId }}"
                            },
                            from: "{{ event()['event.start'] }}",
                            to:   now()
                        EOT
                    }
                )
              name        = "task2"
                # (4 unchanged attributes hidden)
              conditions {
                  custom = "{{ result('task1').records | length &amp;gt; 0 }}"
                  else   = "STOP"
                  states = {
                      "task1" = "SUCCESS"
                    }
                }
              position {
                  x = 1
                  y = 2
                }
            }
          task {
              action      = "dynatrace.msteams:send-message"
              active      = true
              description = "Task 3"
              input       = jsonencode(
                    {
                      connectionId  = "ConnectionID"
                      message       = jsonencode({...})
                    }
                )
              name        = "task3"
                # (4 unchanged attributes hidden)
              conditions {
                  custom = "{{ result('task1').records | length &amp;gt; 0 }}"
                  else   = "STOP"
                  states = {
                      "task1" = "SUCCESS"
                      "task2"   = "SUCCESS"
                    }
                }
              position {
                  x = 0
                  y = 3
                }
            }
        }
      trigger {
          event {
              active = true
              config {
                  davis_problem {
                      custom_filter     = "custom_filter"
                      entity_tags_match = "all"
                      on_problem_close  = false
                      categories {
                          availability           = false
                          custom                 = true
                          error                  = false
                          info                   = false
                          monitoring_unavailable = false
                          resource               = false
                          slowdown               = false
                        }
                    }
                }
            }
        }
    }&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;The&amp;nbsp;&lt;SPAN&gt;request is:&lt;BR /&gt;POST https://{environmentid}.apps.dynatrace.com/platform/automation/v1/workflows?adminAccess=true&lt;BR /&gt;The response is HTTP 400:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "error": {
    "message": "Invalid request.",
    "code": 400,
    "details": {
      "trigger": {
        "eventTrigger": "Error occurred when creating Event Trigger. Reason: custom_filter isn't allowed here."
      }
    }
  }
}&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;It seems that the issue has to do with the event filter defined here:&amp;nbsp;&lt;STRONG&gt;custom_filter = "custom_filter"&lt;/STRONG&gt;, but why can't I create a workflow with a custom event that perfectly works in a similar workflow created manually?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;Does anybody know what I can do to resolve the issue? Is there a way to export a custom alert and then create it in a JSON or Terraform via Dynatrace API?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2026 14:46:59 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/Error-on-trying-to-publish-a-new-workflow-using-Terraform-and/m-p/304746#M2739</guid>
      <dc:creator>cometa</dc:creator>
      <dc:date>2026-09-24T14:46:59Z</dc:date>
    </item>
  </channel>
</rss>

