1. Packages
  2. Datadog Provider
  3. API Docs
  4. WorkflowAutomation
Datadog v4.49.0 published on Thursday, Apr 17, 2025 by Pulumi

datadog.WorkflowAutomation

Explore with Pulumi AI

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";

const workflow = new datadog.WorkflowAutomation("workflow", {
    name: "Send Email when Monitor Alerts",
    description: "This workflow alerts me by email when my monitor goes off. ",
    tags: [
        "service:foo",
        "source:alert",
        "team:bar",
    ],
    published: true,
    specJson: JSON.stringify({
        triggers: [{
            startStepNames: ["Send_Email"],
            monitorTrigger: {},
        }],
        steps: [{
            name: "Send_Email",
            actionId: "com.datadoghq.email.send",
            parameters: [
                {
                    name: "to",
                    value: "REPLACE_ME",
                },
                {
                    name: "subject",
                    value: "Monitor \"{{ Source.monitor.name }}\" alerted",
                },
                {
                    name: "message",
                    value: `This message is from {{ WorkflowName }}. 

You can find a link to the monitor here: {{ Source.url }}.`,
                },
            ],
            display: {
                bounds: {
                    x: 0,
                    y: 216,
                },
            },
        }],
        handle: "my-handle",
    }),
});
Copy
import pulumi
import json
import pulumi_datadog as datadog

workflow = datadog.WorkflowAutomation("workflow",
    name="Send Email when Monitor Alerts",
    description="This workflow alerts me by email when my monitor goes off. ",
    tags=[
        "service:foo",
        "source:alert",
        "team:bar",
    ],
    published=True,
    spec_json=json.dumps({
        "triggers": [{
            "startStepNames": ["Send_Email"],
            "monitorTrigger": {},
        }],
        "steps": [{
            "name": "Send_Email",
            "actionId": "com.datadoghq.email.send",
            "parameters": [
                {
                    "name": "to",
                    "value": "REPLACE_ME",
                },
                {
                    "name": "subject",
                    "value": "Monitor \"{{ Source.monitor.name }}\" alerted",
                },
                {
                    "name": "message",
                    "value": """This message is from {{ WorkflowName }}. 

You can find a link to the monitor here: {{ Source.url }}.""",
                },
            ],
            "display": {
                "bounds": {
                    "x": 0,
                    "y": 216,
                },
            },
        }],
        "handle": "my-handle",
    }))
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-datadog/sdk/v4/go/datadog"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"triggers": []map[string]interface{}{
				map[string]interface{}{
					"startStepNames": []string{
						"Send_Email",
					},
					"monitorTrigger": map[string]interface{}{},
				},
			},
			"steps": []map[string]interface{}{
				map[string]interface{}{
					"name":     "Send_Email",
					"actionId": "com.datadoghq.email.send",
					"parameters": []map[string]interface{}{
						map[string]interface{}{
							"name":  "to",
							"value": "REPLACE_ME",
						},
						map[string]interface{}{
							"name":  "subject",
							"value": "Monitor \"{{ Source.monitor.name }}\" alerted",
						},
						map[string]interface{}{
							"name":  "message",
							"value": "This message is from {{ WorkflowName }}. \n\nYou can find a link to the monitor here: {{ Source.url }}.",
						},
					},
					"display": map[string]interface{}{
						"bounds": map[string]interface{}{
							"x": 0,
							"y": 216,
						},
					},
				},
			},
			"handle": "my-handle",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = datadog.NewWorkflowAutomation(ctx, "workflow", &datadog.WorkflowAutomationArgs{
			Name:        pulumi.String("Send Email when Monitor Alerts"),
			Description: pulumi.String("This workflow alerts me by email when my monitor goes off. "),
			Tags: pulumi.StringArray{
				pulumi.String("service:foo"),
				pulumi.String("source:alert"),
				pulumi.String("team:bar"),
			},
			Published: pulumi.Bool(true),
			SpecJson:  pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Datadog = Pulumi.Datadog;

return await Deployment.RunAsync(() => 
{
    var workflow = new Datadog.WorkflowAutomation("workflow", new()
    {
        Name = "Send Email when Monitor Alerts",
        Description = "This workflow alerts me by email when my monitor goes off. ",
        Tags = new[]
        {
            "service:foo",
            "source:alert",
            "team:bar",
        },
        Published = true,
        SpecJson = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["triggers"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["startStepNames"] = new[]
                    {
                        "Send_Email",
                    },
                    ["monitorTrigger"] = new Dictionary<string, object?>
                    {
                    },
                },
            },
            ["steps"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["name"] = "Send_Email",
                    ["actionId"] = "com.datadoghq.email.send",
                    ["parameters"] = new[]
                    {
                        new Dictionary<string, object?>
                        {
                            ["name"] = "to",
                            ["value"] = "REPLACE_ME",
                        },
                        new Dictionary<string, object?>
                        {
                            ["name"] = "subject",
                            ["value"] = "Monitor \"{{ Source.monitor.name }}\" alerted",
                        },
                        new Dictionary<string, object?>
                        {
                            ["name"] = "message",
                            ["value"] = @"This message is from {{ WorkflowName }}. 

You can find a link to the monitor here: {{ Source.url }}.",
                        },
                    },
                    ["display"] = new Dictionary<string, object?>
                    {
                        ["bounds"] = new Dictionary<string, object?>
                        {
                            ["x"] = 0,
                            ["y"] = 216,
                        },
                    },
                },
            },
            ["handle"] = "my-handle",
        }),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.datadog.WorkflowAutomation;
import com.pulumi.datadog.WorkflowAutomationArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var workflow = new WorkflowAutomation("workflow", WorkflowAutomationArgs.builder()
            .name("Send Email when Monitor Alerts")
            .description("This workflow alerts me by email when my monitor goes off. ")
            .tags(            
                "service:foo",
                "source:alert",
                "team:bar")
            .published(true)
            .specJson(serializeJson(
                jsonObject(
                    jsonProperty("triggers", jsonArray(jsonObject(
                        jsonProperty("startStepNames", jsonArray("Send_Email")),
                        jsonProperty("monitorTrigger", jsonObject(

                        ))
                    ))),
                    jsonProperty("steps", jsonArray(jsonObject(
                        jsonProperty("name", "Send_Email"),
                        jsonProperty("actionId", "com.datadoghq.email.send"),
                        jsonProperty("parameters", jsonArray(
                            jsonObject(
                                jsonProperty("name", "to"),
                                jsonProperty("value", "REPLACE_ME")
                            ), 
                            jsonObject(
                                jsonProperty("name", "subject"),
                                jsonProperty("value", "Monitor \"{{ Source.monitor.name }}\" alerted")
                            ), 
                            jsonObject(
                                jsonProperty("name", "message"),
                                jsonProperty("value", """
This message is from {{ WorkflowName }}. 

You can find a link to the monitor here: {{ Source.url }}.                                """)
                            )
                        )),
                        jsonProperty("display", jsonObject(
                            jsonProperty("bounds", jsonObject(
                                jsonProperty("x", 0),
                                jsonProperty("y", 216)
                            ))
                        ))
                    ))),
                    jsonProperty("handle", "my-handle")
                )))
            .build());

    }
}
Copy
resources:
  workflow:
    type: datadog:WorkflowAutomation
    properties:
      name: Send Email when Monitor Alerts
      description: 'This workflow alerts me by email when my monitor goes off. '
      tags:
        - service:foo
        - source:alert
        - team:bar
      published: true
      specJson:
        fn::toJSON:
          triggers:
            - startStepNames:
                - Send_Email
              monitorTrigger: {}
          steps:
            - name: Send_Email
              actionId: com.datadoghq.email.send
              parameters:
                - name: to
                  value: REPLACE_ME
                - name: subject
                  value: Monitor "{{ Source.monitor.name }}" alerted
                - name: message
                  value: "This message is from {{ WorkflowName }}. \n\nYou can find a link to the monitor here: {{ Source.url }}."
              display:
                bounds:
                  x: 0
                  y: 216
          handle: my-handle
Copy

Create WorkflowAutomation Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new WorkflowAutomation(name: string, args: WorkflowAutomationArgs, opts?: CustomResourceOptions);
@overload
def WorkflowAutomation(resource_name: str,
                       args: WorkflowAutomationArgs,
                       opts: Optional[ResourceOptions] = None)

@overload
def WorkflowAutomation(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       description: Optional[str] = None,
                       name: Optional[str] = None,
                       published: Optional[bool] = None,
                       spec_json: Optional[str] = None,
                       tags: Optional[Sequence[str]] = None,
                       webhook_secret: Optional[str] = None)
func NewWorkflowAutomation(ctx *Context, name string, args WorkflowAutomationArgs, opts ...ResourceOption) (*WorkflowAutomation, error)
public WorkflowAutomation(string name, WorkflowAutomationArgs args, CustomResourceOptions? opts = null)
public WorkflowAutomation(String name, WorkflowAutomationArgs args)
public WorkflowAutomation(String name, WorkflowAutomationArgs args, CustomResourceOptions options)
type: datadog:WorkflowAutomation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. WorkflowAutomationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. WorkflowAutomationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. WorkflowAutomationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. WorkflowAutomationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WorkflowAutomationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var workflowAutomationResource = new Datadog.WorkflowAutomation("workflowAutomationResource", new()
{
    Description = "string",
    Name = "string",
    Published = false,
    SpecJson = "string",
    Tags = new[]
    {
        "string",
    },
    WebhookSecret = "string",
});
Copy
example, err := datadog.NewWorkflowAutomation(ctx, "workflowAutomationResource", &datadog.WorkflowAutomationArgs{
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
	Published:   pulumi.Bool(false),
	SpecJson:    pulumi.String("string"),
	Tags: pulumi.StringArray{
		pulumi.String("string"),
	},
	WebhookSecret: pulumi.String("string"),
})
Copy
var workflowAutomationResource = new WorkflowAutomation("workflowAutomationResource", WorkflowAutomationArgs.builder()
    .description("string")
    .name("string")
    .published(false)
    .specJson("string")
    .tags("string")
    .webhookSecret("string")
    .build());
Copy
workflow_automation_resource = datadog.WorkflowAutomation("workflowAutomationResource",
    description="string",
    name="string",
    published=False,
    spec_json="string",
    tags=["string"],
    webhook_secret="string")
Copy
const workflowAutomationResource = new datadog.WorkflowAutomation("workflowAutomationResource", {
    description: "string",
    name: "string",
    published: false,
    specJson: "string",
    tags: ["string"],
    webhookSecret: "string",
});
Copy
type: datadog:WorkflowAutomation
properties:
    description: string
    name: string
    published: false
    specJson: string
    tags:
        - string
    webhookSecret: string
Copy

WorkflowAutomation Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The WorkflowAutomation resource accepts the following input properties:

Description This property is required. string
Description of the workflow.
Name This property is required. string
Name of the workflow. String length must be at least 1.
Published This property is required. bool
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
SpecJson This property is required. string
The spec defines what the workflow does.
Tags This property is required. List<string>
Tags of the workflow.
WebhookSecret string
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
Description This property is required. string
Description of the workflow.
Name This property is required. string
Name of the workflow. String length must be at least 1.
Published This property is required. bool
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
SpecJson This property is required. string
The spec defines what the workflow does.
Tags This property is required. []string
Tags of the workflow.
WebhookSecret string
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
description This property is required. String
Description of the workflow.
name This property is required. String
Name of the workflow. String length must be at least 1.
published This property is required. Boolean
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
specJson This property is required. String
The spec defines what the workflow does.
tags This property is required. List<String>
Tags of the workflow.
webhookSecret String
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
description This property is required. string
Description of the workflow.
name This property is required. string
Name of the workflow. String length must be at least 1.
published This property is required. boolean
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
specJson This property is required. string
The spec defines what the workflow does.
tags This property is required. string[]
Tags of the workflow.
webhookSecret string
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
description This property is required. str
Description of the workflow.
name This property is required. str
Name of the workflow. String length must be at least 1.
published This property is required. bool
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
spec_json This property is required. str
The spec defines what the workflow does.
tags This property is required. Sequence[str]
Tags of the workflow.
webhook_secret str
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
description This property is required. String
Description of the workflow.
name This property is required. String
Name of the workflow. String length must be at least 1.
published This property is required. Boolean
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
specJson This property is required. String
The spec defines what the workflow does.
tags This property is required. List<String>
Tags of the workflow.
webhookSecret String
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.

Outputs

All input properties are implicitly available as output properties. Additionally, the WorkflowAutomation resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing WorkflowAutomation Resource

Get an existing WorkflowAutomation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: WorkflowAutomationState, opts?: CustomResourceOptions): WorkflowAutomation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        published: Optional[bool] = None,
        spec_json: Optional[str] = None,
        tags: Optional[Sequence[str]] = None,
        webhook_secret: Optional[str] = None) -> WorkflowAutomation
func GetWorkflowAutomation(ctx *Context, name string, id IDInput, state *WorkflowAutomationState, opts ...ResourceOption) (*WorkflowAutomation, error)
public static WorkflowAutomation Get(string name, Input<string> id, WorkflowAutomationState? state, CustomResourceOptions? opts = null)
public static WorkflowAutomation get(String name, Output<String> id, WorkflowAutomationState state, CustomResourceOptions options)
resources:  _:    type: datadog:WorkflowAutomation    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description string
Description of the workflow.
Name string
Name of the workflow. String length must be at least 1.
Published bool
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
SpecJson string
The spec defines what the workflow does.
Tags List<string>
Tags of the workflow.
WebhookSecret string
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
Description string
Description of the workflow.
Name string
Name of the workflow. String length must be at least 1.
Published bool
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
SpecJson string
The spec defines what the workflow does.
Tags []string
Tags of the workflow.
WebhookSecret string
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
description String
Description of the workflow.
name String
Name of the workflow. String length must be at least 1.
published Boolean
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
specJson String
The spec defines what the workflow does.
tags List<String>
Tags of the workflow.
webhookSecret String
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
description string
Description of the workflow.
name string
Name of the workflow. String length must be at least 1.
published boolean
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
specJson string
The spec defines what the workflow does.
tags string[]
Tags of the workflow.
webhookSecret string
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
description str
Description of the workflow.
name str
Name of the workflow. String length must be at least 1.
published bool
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
spec_json str
The spec defines what the workflow does.
tags Sequence[str]
Tags of the workflow.
webhook_secret str
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.
description String
Description of the workflow.
name String
Name of the workflow. String length must be at least 1.
published Boolean
Set the workflow to published or unpublished. Workflows in an unpublished state are only executable through manual runs. Automatic triggers such as Schedule do not execute the workflow until it is published.
specJson String
The spec defines what the workflow does.
tags List<String>
Tags of the workflow.
webhookSecret String
If a webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here. String length must be at least 16.

Import

$ pulumi import datadog:index/workflowAutomation:WorkflowAutomation my_workflow 11111111-2222-3333-4444-555555555555
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Datadog pulumi/pulumi-datadog
License
Apache-2.0
Notes
This Pulumi package is based on the datadog Terraform Provider.