24 Sep 2026 03:42 PM - edited 24 Sep 2026 03:46 PM
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
The Terraform config:
# 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 = <<-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 = <<-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 > 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 > 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
}
}
}
}
}
}The request is:
POST https://{environmentid}.apps.dynatrace.com/platform/automation/v1/workflows?adminAccess=true
The response is HTTP 400:
{
"error": {
"message": "Invalid request.",
"code": 400,
"details": {
"trigger": {
"eventTrigger": "Error occurred when creating Event Trigger. Reason: custom_filter isn't allowed here."
}
}
}
}It seems that the issue has to do with the event filter defined here: custom_filter = "custom_filter", but why can't I create a workflow with a custom event that perfectly works in a similar workflow created manually?
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?
Featured Posts