1. Packages
  2. Dynatrace
  3. API Docs
  4. Segment
Dynatrace v0.27.0 published on Friday, Mar 21, 2025 by Pulumiverse

dynatrace.Segment

Explore with Pulumi AI

Dynatrace SaaS only

To utilize this resource with access to all segments, please define the environment variables DT_CLIENT_ID, DT_CLIENT_SECRET, DT_ACCOUNT_ID with an OAuth client including the following permissions: View Filter-Segments (storage:filter-segments:read), Create and Update Filter-Segments (storage:filter-segments:write), Share Filter-Segments (storage:filter-segments:share), Delete Filter-Segments (storage:filter-segments:delete) and Maintain all Filter-Segments on the environment (storage:filter-segments:admin).

This resource is excluded by default in the export utility, please explicitly specify the resource to retrieve existing configuration.

The includes.items[X].filter attribute, which is a JSON string, is unfriendly for configuration as code. The structure of that attribute is not publicly documented and therefore subject to change without warning. The resource schema has been created to match our REST API, but we will be reaching out to product management on further enhancement of this endpoint. In the meantime, please use the export utility to create configurations more efficiently.

Dynatrace Documentation

  • Segments - https://docs.dynatrace.com/docs/manage/segments

  • Grail Storage Filter-Segments (API) - https://########.apps.dynatrace.com/platform/swagger-ui/index.html?urls.primaryName=Grail+-+Filter+Segments

Resource Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as dynatrace from "@pulumiverse/dynatrace";

// ID GQ7NqJGPV1N
const _name_ = new dynatrace.Segment("#name#", {
    description: "Example description",
    isPublic: true,
    includes: {
        items: [
            {
                dataObject: "_all_data_object",
                filter: JSON.stringify({
                    children: [{
                        key: {
                            range: {
                                from: 0,
                                to: 16,
                            },
                            textValue: "k8s.cluster.name",
                            type: "Key",
                            value: "k8s.cluster.name",
                        },
                        operator: {
                            range: {
                                from: 17,
                                to: 18,
                            },
                            textValue: "=",
                            type: "ComparisonOperator",
                            value: "=",
                        },
                        range: {
                            from: 0,
                            to: 27,
                        },
                        type: "Statement",
                        value: {
                            range: {
                                from: 19,
                                to: 27,
                            },
                            textValue: "$cluster",
                            type: "String",
                            value: "$cluster",
                        },
                    }],
                    explicit: false,
                    logicalOperator: "AND",
                    range: {
                        from: 0,
                        to: 27,
                    },
                    type: "Group",
                }),
            },
            {
                dataObject: "dt.entity.cloud_application",
                filter: "",
                relationship: {
                    name: "clustered_by",
                    target: "dt.entity.kubernetes_cluster",
                },
            },
            {
                dataObject: "dt.entity.cloud_application_instance",
                filter: "",
                relationship: {
                    name: "clustered_by",
                    target: "dt.entity.kubernetes_cluster",
                },
            },
            {
                dataObject: "dt.entity.cloud_application_namespace",
                filter: "",
                relationship: {
                    name: "clustered_by",
                    target: "dt.entity.kubernetes_cluster",
                },
            },
            {
                dataObject: "dt.entity.container_group_instance",
                filter: "",
                relationship: {
                    name: "belongs_to",
                    target: "dt.entity.kubernetes_cluster",
                },
            },
            {
                dataObject: "dt.entity.host",
                filter: "",
                relationship: {
                    name: "clustered_by",
                    target: "dt.entity.kubernetes_cluster",
                },
            },
            {
                dataObject: "dt.entity.kubernetes_cluster",
                filter: JSON.stringify({
                    children: [{
                        key: {
                            range: {
                                from: 0,
                                to: 11,
                            },
                            textValue: "entity.name",
                            type: "Key",
                            value: "entity.name",
                        },
                        operator: {
                            range: {
                                from: 12,
                                to: 13,
                            },
                            textValue: "=",
                            type: "ComparisonOperator",
                            value: "=",
                        },
                        range: {
                            from: 0,
                            to: 22,
                        },
                        type: "Statement",
                        value: {
                            range: {
                                from: 14,
                                to: 22,
                            },
                            textValue: "$cluster",
                            type: "String",
                            value: "$cluster",
                        },
                    }],
                    explicit: false,
                    logicalOperator: "AND",
                    range: {
                        from: 0,
                        to: 22,
                    },
                    type: "Group",
                }),
            },
            {
                dataObject: "dt.entity.kubernetes_node",
                filter: "",
                relationship: {
                    name: "clustered_by",
                    target: "dt.entity.kubernetes_cluster",
                },
            },
            {
                dataObject: "dt.entity.kubernetes_service",
                filter: "",
                relationship: {
                    name: "clustered_by",
                    target: "dt.entity.kubernetes_cluster",
                },
            },
            {
                dataObject: "dt.entity.service",
                filter: "",
                relationship: {
                    name: "clustered_by",
                    target: "dt.entity.kubernetes_cluster",
                },
            },
        ],
    },
    variables: {
        type: "query",
        value: `fetch dt.entity.kubernetes_cluster
| fields cluster = entity.name
| sort cluster
`,
    },
});
Copy
import pulumi
import json
import pulumiverse_dynatrace as dynatrace

# ID GQ7NqJGPV1N
_name_ = dynatrace.Segment("#name#",
    description="Example description",
    is_public=True,
    includes={
        "items": [
            {
                "data_object": "_all_data_object",
                "filter": json.dumps({
                    "children": [{
                        "key": {
                            "range": {
                                "from": 0,
                                "to": 16,
                            },
                            "textValue": "k8s.cluster.name",
                            "type": "Key",
                            "value": "k8s.cluster.name",
                        },
                        "operator": {
                            "range": {
                                "from": 17,
                                "to": 18,
                            },
                            "textValue": "=",
                            "type": "ComparisonOperator",
                            "value": "=",
                        },
                        "range": {
                            "from": 0,
                            "to": 27,
                        },
                        "type": "Statement",
                        "value": {
                            "range": {
                                "from": 19,
                                "to": 27,
                            },
                            "textValue": "$cluster",
                            "type": "String",
                            "value": "$cluster",
                        },
                    }],
                    "explicit": False,
                    "logicalOperator": "AND",
                    "range": {
                        "from": 0,
                        "to": 27,
                    },
                    "type": "Group",
                }),
            },
            {
                "data_object": "dt.entity.cloud_application",
                "filter": "",
                "relationship": {
                    "name": "clustered_by",
                    "target": "dt.entity.kubernetes_cluster",
                },
            },
            {
                "data_object": "dt.entity.cloud_application_instance",
                "filter": "",
                "relationship": {
                    "name": "clustered_by",
                    "target": "dt.entity.kubernetes_cluster",
                },
            },
            {
                "data_object": "dt.entity.cloud_application_namespace",
                "filter": "",
                "relationship": {
                    "name": "clustered_by",
                    "target": "dt.entity.kubernetes_cluster",
                },
            },
            {
                "data_object": "dt.entity.container_group_instance",
                "filter": "",
                "relationship": {
                    "name": "belongs_to",
                    "target": "dt.entity.kubernetes_cluster",
                },
            },
            {
                "data_object": "dt.entity.host",
                "filter": "",
                "relationship": {
                    "name": "clustered_by",
                    "target": "dt.entity.kubernetes_cluster",
                },
            },
            {
                "data_object": "dt.entity.kubernetes_cluster",
                "filter": json.dumps({
                    "children": [{
                        "key": {
                            "range": {
                                "from": 0,
                                "to": 11,
                            },
                            "textValue": "entity.name",
                            "type": "Key",
                            "value": "entity.name",
                        },
                        "operator": {
                            "range": {
                                "from": 12,
                                "to": 13,
                            },
                            "textValue": "=",
                            "type": "ComparisonOperator",
                            "value": "=",
                        },
                        "range": {
                            "from": 0,
                            "to": 22,
                        },
                        "type": "Statement",
                        "value": {
                            "range": {
                                "from": 14,
                                "to": 22,
                            },
                            "textValue": "$cluster",
                            "type": "String",
                            "value": "$cluster",
                        },
                    }],
                    "explicit": False,
                    "logicalOperator": "AND",
                    "range": {
                        "from": 0,
                        "to": 22,
                    },
                    "type": "Group",
                }),
            },
            {
                "data_object": "dt.entity.kubernetes_node",
                "filter": "",
                "relationship": {
                    "name": "clustered_by",
                    "target": "dt.entity.kubernetes_cluster",
                },
            },
            {
                "data_object": "dt.entity.kubernetes_service",
                "filter": "",
                "relationship": {
                    "name": "clustered_by",
                    "target": "dt.entity.kubernetes_cluster",
                },
            },
            {
                "data_object": "dt.entity.service",
                "filter": "",
                "relationship": {
                    "name": "clustered_by",
                    "target": "dt.entity.kubernetes_cluster",
                },
            },
        ],
    },
    variables={
        "type": "query",
        "value": """fetch dt.entity.kubernetes_cluster
| fields cluster = entity.name
| sort cluster
""",
    })
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-dynatrace/sdk/go/dynatrace"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"children": []map[string]interface{}{
				map[string]interface{}{
					"key": map[string]interface{}{
						"range": map[string]interface{}{
							"from": 0,
							"to":   16,
						},
						"textValue": "k8s.cluster.name",
						"type":      "Key",
						"value":     "k8s.cluster.name",
					},
					"operator": map[string]interface{}{
						"range": map[string]interface{}{
							"from": 17,
							"to":   18,
						},
						"textValue": "=",
						"type":      "ComparisonOperator",
						"value":     "=",
					},
					"range": map[string]interface{}{
						"from": 0,
						"to":   27,
					},
					"type": "Statement",
					"value": map[string]interface{}{
						"range": map[string]interface{}{
							"from": 19,
							"to":   27,
						},
						"textValue": "$cluster",
						"type":      "String",
						"value":     "$cluster",
					},
				},
			},
			"explicit":        false,
			"logicalOperator": "AND",
			"range": map[string]interface{}{
				"from": 0,
				"to":   27,
			},
			"type": "Group",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		tmpJSON1, err := json.Marshal(map[string]interface{}{
			"children": []map[string]interface{}{
				map[string]interface{}{
					"key": map[string]interface{}{
						"range": map[string]interface{}{
							"from": 0,
							"to":   11,
						},
						"textValue": "entity.name",
						"type":      "Key",
						"value":     "entity.name",
					},
					"operator": map[string]interface{}{
						"range": map[string]interface{}{
							"from": 12,
							"to":   13,
						},
						"textValue": "=",
						"type":      "ComparisonOperator",
						"value":     "=",
					},
					"range": map[string]interface{}{
						"from": 0,
						"to":   22,
					},
					"type": "Statement",
					"value": map[string]interface{}{
						"range": map[string]interface{}{
							"from": 14,
							"to":   22,
						},
						"textValue": "$cluster",
						"type":      "String",
						"value":     "$cluster",
					},
				},
			},
			"explicit":        false,
			"logicalOperator": "AND",
			"range": map[string]interface{}{
				"from": 0,
				"to":   22,
			},
			"type": "Group",
		})
		if err != nil {
			return err
		}
		json1 := string(tmpJSON1)
		// ID GQ7NqJGPV1N
		_, err = dynatrace.NewSegment(ctx, "#name#", &dynatrace.SegmentArgs{
			Description: pulumi.String("Example description"),
			IsPublic:    pulumi.Bool(true),
			Includes: &dynatrace.SegmentIncludesArgs{
				Items: dynatrace.SegmentIncludesItemArray{
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("_all_data_object"),
						Filter:     pulumi.String(json0),
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.cloud_application"),
						Filter:     pulumi.String(""),
						Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
							Name:   pulumi.String("clustered_by"),
							Target: pulumi.String("dt.entity.kubernetes_cluster"),
						},
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.cloud_application_instance"),
						Filter:     pulumi.String(""),
						Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
							Name:   pulumi.String("clustered_by"),
							Target: pulumi.String("dt.entity.kubernetes_cluster"),
						},
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.cloud_application_namespace"),
						Filter:     pulumi.String(""),
						Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
							Name:   pulumi.String("clustered_by"),
							Target: pulumi.String("dt.entity.kubernetes_cluster"),
						},
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.container_group_instance"),
						Filter:     pulumi.String(""),
						Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
							Name:   pulumi.String("belongs_to"),
							Target: pulumi.String("dt.entity.kubernetes_cluster"),
						},
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.host"),
						Filter:     pulumi.String(""),
						Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
							Name:   pulumi.String("clustered_by"),
							Target: pulumi.String("dt.entity.kubernetes_cluster"),
						},
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.kubernetes_cluster"),
						Filter:     pulumi.String(json1),
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.kubernetes_node"),
						Filter:     pulumi.String(""),
						Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
							Name:   pulumi.String("clustered_by"),
							Target: pulumi.String("dt.entity.kubernetes_cluster"),
						},
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.kubernetes_service"),
						Filter:     pulumi.String(""),
						Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
							Name:   pulumi.String("clustered_by"),
							Target: pulumi.String("dt.entity.kubernetes_cluster"),
						},
					},
					&dynatrace.SegmentIncludesItemArgs{
						DataObject: pulumi.String("dt.entity.service"),
						Filter:     pulumi.String(""),
						Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
							Name:   pulumi.String("clustered_by"),
							Target: pulumi.String("dt.entity.kubernetes_cluster"),
						},
					},
				},
			},
			Variables: &dynatrace.SegmentVariablesArgs{
				Type:  pulumi.String("query"),
				Value: pulumi.String("fetch dt.entity.kubernetes_cluster\n| fields cluster = entity.name\n| sort cluster\n"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Dynatrace = Pulumiverse.Dynatrace;

return await Deployment.RunAsync(() => 
{
    // ID GQ7NqJGPV1N
    var _name_ = new Dynatrace.Segment("#name#", new()
    {
        Description = "Example description",
        IsPublic = true,
        Includes = new Dynatrace.Inputs.SegmentIncludesArgs
        {
            Items = new[]
            {
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "_all_data_object",
                    Filter = JsonSerializer.Serialize(new Dictionary<string, object?>
                    {
                        ["children"] = new[]
                        {
                            new Dictionary<string, object?>
                            {
                                ["key"] = new Dictionary<string, object?>
                                {
                                    ["range"] = new Dictionary<string, object?>
                                    {
                                        ["from"] = 0,
                                        ["to"] = 16,
                                    },
                                    ["textValue"] = "k8s.cluster.name",
                                    ["type"] = "Key",
                                    ["value"] = "k8s.cluster.name",
                                },
                                ["operator"] = new Dictionary<string, object?>
                                {
                                    ["range"] = new Dictionary<string, object?>
                                    {
                                        ["from"] = 17,
                                        ["to"] = 18,
                                    },
                                    ["textValue"] = "=",
                                    ["type"] = "ComparisonOperator",
                                    ["value"] = "=",
                                },
                                ["range"] = new Dictionary<string, object?>
                                {
                                    ["from"] = 0,
                                    ["to"] = 27,
                                },
                                ["type"] = "Statement",
                                ["value"] = new Dictionary<string, object?>
                                {
                                    ["range"] = new Dictionary<string, object?>
                                    {
                                        ["from"] = 19,
                                        ["to"] = 27,
                                    },
                                    ["textValue"] = "$cluster",
                                    ["type"] = "String",
                                    ["value"] = "$cluster",
                                },
                            },
                        },
                        ["explicit"] = false,
                        ["logicalOperator"] = "AND",
                        ["range"] = new Dictionary<string, object?>
                        {
                            ["from"] = 0,
                            ["to"] = 27,
                        },
                        ["type"] = "Group",
                    }),
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.cloud_application",
                    Filter = "",
                    Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                    {
                        Name = "clustered_by",
                        Target = "dt.entity.kubernetes_cluster",
                    },
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.cloud_application_instance",
                    Filter = "",
                    Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                    {
                        Name = "clustered_by",
                        Target = "dt.entity.kubernetes_cluster",
                    },
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.cloud_application_namespace",
                    Filter = "",
                    Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                    {
                        Name = "clustered_by",
                        Target = "dt.entity.kubernetes_cluster",
                    },
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.container_group_instance",
                    Filter = "",
                    Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                    {
                        Name = "belongs_to",
                        Target = "dt.entity.kubernetes_cluster",
                    },
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.host",
                    Filter = "",
                    Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                    {
                        Name = "clustered_by",
                        Target = "dt.entity.kubernetes_cluster",
                    },
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.kubernetes_cluster",
                    Filter = JsonSerializer.Serialize(new Dictionary<string, object?>
                    {
                        ["children"] = new[]
                        {
                            new Dictionary<string, object?>
                            {
                                ["key"] = new Dictionary<string, object?>
                                {
                                    ["range"] = new Dictionary<string, object?>
                                    {
                                        ["from"] = 0,
                                        ["to"] = 11,
                                    },
                                    ["textValue"] = "entity.name",
                                    ["type"] = "Key",
                                    ["value"] = "entity.name",
                                },
                                ["operator"] = new Dictionary<string, object?>
                                {
                                    ["range"] = new Dictionary<string, object?>
                                    {
                                        ["from"] = 12,
                                        ["to"] = 13,
                                    },
                                    ["textValue"] = "=",
                                    ["type"] = "ComparisonOperator",
                                    ["value"] = "=",
                                },
                                ["range"] = new Dictionary<string, object?>
                                {
                                    ["from"] = 0,
                                    ["to"] = 22,
                                },
                                ["type"] = "Statement",
                                ["value"] = new Dictionary<string, object?>
                                {
                                    ["range"] = new Dictionary<string, object?>
                                    {
                                        ["from"] = 14,
                                        ["to"] = 22,
                                    },
                                    ["textValue"] = "$cluster",
                                    ["type"] = "String",
                                    ["value"] = "$cluster",
                                },
                            },
                        },
                        ["explicit"] = false,
                        ["logicalOperator"] = "AND",
                        ["range"] = new Dictionary<string, object?>
                        {
                            ["from"] = 0,
                            ["to"] = 22,
                        },
                        ["type"] = "Group",
                    }),
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.kubernetes_node",
                    Filter = "",
                    Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                    {
                        Name = "clustered_by",
                        Target = "dt.entity.kubernetes_cluster",
                    },
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.kubernetes_service",
                    Filter = "",
                    Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                    {
                        Name = "clustered_by",
                        Target = "dt.entity.kubernetes_cluster",
                    },
                },
                new Dynatrace.Inputs.SegmentIncludesItemArgs
                {
                    DataObject = "dt.entity.service",
                    Filter = "",
                    Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                    {
                        Name = "clustered_by",
                        Target = "dt.entity.kubernetes_cluster",
                    },
                },
            },
        },
        Variables = new Dynatrace.Inputs.SegmentVariablesArgs
        {
            Type = "query",
            Value = @"fetch dt.entity.kubernetes_cluster
| fields cluster = entity.name
| sort cluster
",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.dynatrace.Segment;
import com.pulumi.dynatrace.SegmentArgs;
import com.pulumi.dynatrace.inputs.SegmentIncludesArgs;
import com.pulumi.dynatrace.inputs.SegmentVariablesArgs;
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) {
        // ID GQ7NqJGPV1N
        var _name_ = new Segment("#name#", SegmentArgs.builder()
            .description("Example description")
            .isPublic(true)
            .includes(SegmentIncludesArgs.builder()
                .items(                
                    SegmentIncludesItemArgs.builder()
                        .dataObject("_all_data_object")
                        .filter(serializeJson(
                            jsonObject(
                                jsonProperty("children", jsonArray(jsonObject(
                                    jsonProperty("key", jsonObject(
                                        jsonProperty("range", jsonObject(
                                            jsonProperty("from", 0),
                                            jsonProperty("to", 16)
                                        )),
                                        jsonProperty("textValue", "k8s.cluster.name"),
                                        jsonProperty("type", "Key"),
                                        jsonProperty("value", "k8s.cluster.name")
                                    )),
                                    jsonProperty("operator", jsonObject(
                                        jsonProperty("range", jsonObject(
                                            jsonProperty("from", 17),
                                            jsonProperty("to", 18)
                                        )),
                                        jsonProperty("textValue", "="),
                                        jsonProperty("type", "ComparisonOperator"),
                                        jsonProperty("value", "=")
                                    )),
                                    jsonProperty("range", jsonObject(
                                        jsonProperty("from", 0),
                                        jsonProperty("to", 27)
                                    )),
                                    jsonProperty("type", "Statement"),
                                    jsonProperty("value", jsonObject(
                                        jsonProperty("range", jsonObject(
                                            jsonProperty("from", 19),
                                            jsonProperty("to", 27)
                                        )),
                                        jsonProperty("textValue", "$cluster"),
                                        jsonProperty("type", "String"),
                                        jsonProperty("value", "$cluster")
                                    ))
                                ))),
                                jsonProperty("explicit", false),
                                jsonProperty("logicalOperator", "AND"),
                                jsonProperty("range", jsonObject(
                                    jsonProperty("from", 0),
                                    jsonProperty("to", 27)
                                )),
                                jsonProperty("type", "Group")
                            )))
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.cloud_application")
                        .filter("")
                        .relationship(SegmentIncludesItemRelationshipArgs.builder()
                            .name("clustered_by")
                            .target("dt.entity.kubernetes_cluster")
                            .build())
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.cloud_application_instance")
                        .filter("")
                        .relationship(SegmentIncludesItemRelationshipArgs.builder()
                            .name("clustered_by")
                            .target("dt.entity.kubernetes_cluster")
                            .build())
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.cloud_application_namespace")
                        .filter("")
                        .relationship(SegmentIncludesItemRelationshipArgs.builder()
                            .name("clustered_by")
                            .target("dt.entity.kubernetes_cluster")
                            .build())
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.container_group_instance")
                        .filter("")
                        .relationship(SegmentIncludesItemRelationshipArgs.builder()
                            .name("belongs_to")
                            .target("dt.entity.kubernetes_cluster")
                            .build())
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.host")
                        .filter("")
                        .relationship(SegmentIncludesItemRelationshipArgs.builder()
                            .name("clustered_by")
                            .target("dt.entity.kubernetes_cluster")
                            .build())
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.kubernetes_cluster")
                        .filter(serializeJson(
                            jsonObject(
                                jsonProperty("children", jsonArray(jsonObject(
                                    jsonProperty("key", jsonObject(
                                        jsonProperty("range", jsonObject(
                                            jsonProperty("from", 0),
                                            jsonProperty("to", 11)
                                        )),
                                        jsonProperty("textValue", "entity.name"),
                                        jsonProperty("type", "Key"),
                                        jsonProperty("value", "entity.name")
                                    )),
                                    jsonProperty("operator", jsonObject(
                                        jsonProperty("range", jsonObject(
                                            jsonProperty("from", 12),
                                            jsonProperty("to", 13)
                                        )),
                                        jsonProperty("textValue", "="),
                                        jsonProperty("type", "ComparisonOperator"),
                                        jsonProperty("value", "=")
                                    )),
                                    jsonProperty("range", jsonObject(
                                        jsonProperty("from", 0),
                                        jsonProperty("to", 22)
                                    )),
                                    jsonProperty("type", "Statement"),
                                    jsonProperty("value", jsonObject(
                                        jsonProperty("range", jsonObject(
                                            jsonProperty("from", 14),
                                            jsonProperty("to", 22)
                                        )),
                                        jsonProperty("textValue", "$cluster"),
                                        jsonProperty("type", "String"),
                                        jsonProperty("value", "$cluster")
                                    ))
                                ))),
                                jsonProperty("explicit", false),
                                jsonProperty("logicalOperator", "AND"),
                                jsonProperty("range", jsonObject(
                                    jsonProperty("from", 0),
                                    jsonProperty("to", 22)
                                )),
                                jsonProperty("type", "Group")
                            )))
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.kubernetes_node")
                        .filter("")
                        .relationship(SegmentIncludesItemRelationshipArgs.builder()
                            .name("clustered_by")
                            .target("dt.entity.kubernetes_cluster")
                            .build())
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.kubernetes_service")
                        .filter("")
                        .relationship(SegmentIncludesItemRelationshipArgs.builder()
                            .name("clustered_by")
                            .target("dt.entity.kubernetes_cluster")
                            .build())
                        .build(),
                    SegmentIncludesItemArgs.builder()
                        .dataObject("dt.entity.service")
                        .filter("")
                        .relationship(SegmentIncludesItemRelationshipArgs.builder()
                            .name("clustered_by")
                            .target("dt.entity.kubernetes_cluster")
                            .build())
                        .build())
                .build())
            .variables(SegmentVariablesArgs.builder()
                .type("query")
                .value("""
fetch dt.entity.kubernetes_cluster
| fields cluster = entity.name
| sort cluster
                """)
                .build())
            .build());

    }
}
Copy
resources:
  # ID GQ7NqJGPV1N
  '#name#':
    type: dynatrace:Segment
    properties:
      description: Example description
      isPublic: true
      includes:
        items:
          - dataObject: _all_data_object
            filter:
              fn::toJSON:
                children:
                  - key:
                      range:
                        from: 0
                        to: 16
                      textValue: k8s.cluster.name
                      type: Key
                      value: k8s.cluster.name
                    operator:
                      range:
                        from: 17
                        to: 18
                      textValue: =
                      type: ComparisonOperator
                      value: =
                    range:
                      from: 0
                      to: 27
                    type: Statement
                    value:
                      range:
                        from: 19
                        to: 27
                      textValue: $cluster
                      type: String
                      value: $cluster
                explicit: false
                logicalOperator: AND
                range:
                  from: 0
                  to: 27
                type: Group
          - dataObject: dt.entity.cloud_application
            filter: ""
            relationship:
              name: clustered_by
              target: dt.entity.kubernetes_cluster
          - dataObject: dt.entity.cloud_application_instance
            filter: ""
            relationship:
              name: clustered_by
              target: dt.entity.kubernetes_cluster
          - dataObject: dt.entity.cloud_application_namespace
            filter: ""
            relationship:
              name: clustered_by
              target: dt.entity.kubernetes_cluster
          - dataObject: dt.entity.container_group_instance
            filter: ""
            relationship:
              name: belongs_to
              target: dt.entity.kubernetes_cluster
          - dataObject: dt.entity.host
            filter: ""
            relationship:
              name: clustered_by
              target: dt.entity.kubernetes_cluster
          - dataObject: dt.entity.kubernetes_cluster
            filter:
              fn::toJSON:
                children:
                  - key:
                      range:
                        from: 0
                        to: 11
                      textValue: entity.name
                      type: Key
                      value: entity.name
                    operator:
                      range:
                        from: 12
                        to: 13
                      textValue: =
                      type: ComparisonOperator
                      value: =
                    range:
                      from: 0
                      to: 22
                    type: Statement
                    value:
                      range:
                        from: 14
                        to: 22
                      textValue: $cluster
                      type: String
                      value: $cluster
                explicit: false
                logicalOperator: AND
                range:
                  from: 0
                  to: 22
                type: Group
          - dataObject: dt.entity.kubernetes_node
            filter: ""
            relationship:
              name: clustered_by
              target: dt.entity.kubernetes_cluster
          - dataObject: dt.entity.kubernetes_service
            filter: ""
            relationship:
              name: clustered_by
              target: dt.entity.kubernetes_cluster
          - dataObject: dt.entity.service
            filter: ""
            relationship:
              name: clustered_by
              target: dt.entity.kubernetes_cluster
      variables:
        type: query
        value: |
          fetch dt.entity.kubernetes_cluster
          | fields cluster = entity.name
          | sort cluster          
Copy

Create Segment Resource

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

Constructor syntax

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

@overload
def Segment(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            is_public: Optional[bool] = None,
            description: Optional[str] = None,
            includes: Optional[SegmentIncludesArgs] = None,
            name: Optional[str] = None,
            variables: Optional[SegmentVariablesArgs] = None)
func NewSegment(ctx *Context, name string, args SegmentArgs, opts ...ResourceOption) (*Segment, error)
public Segment(string name, SegmentArgs args, CustomResourceOptions? opts = null)
public Segment(String name, SegmentArgs args)
public Segment(String name, SegmentArgs args, CustomResourceOptions options)
type: dynatrace:Segment
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. SegmentArgs
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. SegmentArgs
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. SegmentArgs
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. SegmentArgs
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. SegmentArgs
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 segmentResource = new Dynatrace.Segment("segmentResource", new()
{
    IsPublic = false,
    Description = "string",
    Includes = new Dynatrace.Inputs.SegmentIncludesArgs
    {
        Items = new[]
        {
            new Dynatrace.Inputs.SegmentIncludesItemArgs
            {
                DataObject = "string",
                Filter = "string",
                ApplyTos = new[]
                {
                    "string",
                },
                Relationship = new Dynatrace.Inputs.SegmentIncludesItemRelationshipArgs
                {
                    Name = "string",
                    Target = "string",
                },
            },
        },
    },
    Name = "string",
    Variables = new Dynatrace.Inputs.SegmentVariablesArgs
    {
        Type = "string",
        Value = "string",
    },
});
Copy
example, err := dynatrace.NewSegment(ctx, "segmentResource", &dynatrace.SegmentArgs{
	IsPublic:    pulumi.Bool(false),
	Description: pulumi.String("string"),
	Includes: &dynatrace.SegmentIncludesArgs{
		Items: dynatrace.SegmentIncludesItemArray{
			&dynatrace.SegmentIncludesItemArgs{
				DataObject: pulumi.String("string"),
				Filter:     pulumi.String("string"),
				ApplyTos: pulumi.StringArray{
					pulumi.String("string"),
				},
				Relationship: &dynatrace.SegmentIncludesItemRelationshipArgs{
					Name:   pulumi.String("string"),
					Target: pulumi.String("string"),
				},
			},
		},
	},
	Name: pulumi.String("string"),
	Variables: &dynatrace.SegmentVariablesArgs{
		Type:  pulumi.String("string"),
		Value: pulumi.String("string"),
	},
})
Copy
var segmentResource = new Segment("segmentResource", SegmentArgs.builder()
    .isPublic(false)
    .description("string")
    .includes(SegmentIncludesArgs.builder()
        .items(SegmentIncludesItemArgs.builder()
            .dataObject("string")
            .filter("string")
            .applyTos("string")
            .relationship(SegmentIncludesItemRelationshipArgs.builder()
                .name("string")
                .target("string")
                .build())
            .build())
        .build())
    .name("string")
    .variables(SegmentVariablesArgs.builder()
        .type("string")
        .value("string")
        .build())
    .build());
Copy
segment_resource = dynatrace.Segment("segmentResource",
    is_public=False,
    description="string",
    includes={
        "items": [{
            "data_object": "string",
            "filter": "string",
            "apply_tos": ["string"],
            "relationship": {
                "name": "string",
                "target": "string",
            },
        }],
    },
    name="string",
    variables={
        "type": "string",
        "value": "string",
    })
Copy
const segmentResource = new dynatrace.Segment("segmentResource", {
    isPublic: false,
    description: "string",
    includes: {
        items: [{
            dataObject: "string",
            filter: "string",
            applyTos: ["string"],
            relationship: {
                name: "string",
                target: "string",
            },
        }],
    },
    name: "string",
    variables: {
        type: "string",
        value: "string",
    },
});
Copy
type: dynatrace:Segment
properties:
    description: string
    includes:
        items:
            - applyTos:
                - string
              dataObject: string
              filter: string
              relationship:
                name: string
                target: string
    isPublic: false
    name: string
    variables:
        type: string
        value: string
Copy

Segment 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 Segment resource accepts the following input properties:

IsPublic This property is required. bool
Indicates if the filter-segment is publicly accessible within the tenant
Description string
Description of the filter-segment
Includes Pulumiverse.Dynatrace.Inputs.SegmentIncludes
List of includes of the filter-segment
Name string
Name of the filter-segment
Variables Pulumiverse.Dynatrace.Inputs.SegmentVariables
Variables of the filter-segment
IsPublic This property is required. bool
Indicates if the filter-segment is publicly accessible within the tenant
Description string
Description of the filter-segment
Includes SegmentIncludesArgs
List of includes of the filter-segment
Name string
Name of the filter-segment
Variables SegmentVariablesArgs
Variables of the filter-segment
isPublic This property is required. Boolean
Indicates if the filter-segment is publicly accessible within the tenant
description String
Description of the filter-segment
includes SegmentIncludes
List of includes of the filter-segment
name String
Name of the filter-segment
variables SegmentVariables
Variables of the filter-segment
isPublic This property is required. boolean
Indicates if the filter-segment is publicly accessible within the tenant
description string
Description of the filter-segment
includes SegmentIncludes
List of includes of the filter-segment
name string
Name of the filter-segment
variables SegmentVariables
Variables of the filter-segment
is_public This property is required. bool
Indicates if the filter-segment is publicly accessible within the tenant
description str
Description of the filter-segment
includes SegmentIncludesArgs
List of includes of the filter-segment
name str
Name of the filter-segment
variables SegmentVariablesArgs
Variables of the filter-segment
isPublic This property is required. Boolean
Indicates if the filter-segment is publicly accessible within the tenant
description String
Description of the filter-segment
includes Property Map
List of includes of the filter-segment
name String
Name of the filter-segment
variables Property Map
Variables of the filter-segment

Outputs

All input properties are implicitly available as output properties. Additionally, the Segment 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 Segment Resource

Get an existing Segment 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?: SegmentState, opts?: CustomResourceOptions): Segment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        includes: Optional[SegmentIncludesArgs] = None,
        is_public: Optional[bool] = None,
        name: Optional[str] = None,
        variables: Optional[SegmentVariablesArgs] = None) -> Segment
func GetSegment(ctx *Context, name string, id IDInput, state *SegmentState, opts ...ResourceOption) (*Segment, error)
public static Segment Get(string name, Input<string> id, SegmentState? state, CustomResourceOptions? opts = null)
public static Segment get(String name, Output<String> id, SegmentState state, CustomResourceOptions options)
resources:  _:    type: dynatrace:Segment    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 filter-segment
Includes Pulumiverse.Dynatrace.Inputs.SegmentIncludes
List of includes of the filter-segment
IsPublic bool
Indicates if the filter-segment is publicly accessible within the tenant
Name string
Name of the filter-segment
Variables Pulumiverse.Dynatrace.Inputs.SegmentVariables
Variables of the filter-segment
Description string
Description of the filter-segment
Includes SegmentIncludesArgs
List of includes of the filter-segment
IsPublic bool
Indicates if the filter-segment is publicly accessible within the tenant
Name string
Name of the filter-segment
Variables SegmentVariablesArgs
Variables of the filter-segment
description String
Description of the filter-segment
includes SegmentIncludes
List of includes of the filter-segment
isPublic Boolean
Indicates if the filter-segment is publicly accessible within the tenant
name String
Name of the filter-segment
variables SegmentVariables
Variables of the filter-segment
description string
Description of the filter-segment
includes SegmentIncludes
List of includes of the filter-segment
isPublic boolean
Indicates if the filter-segment is publicly accessible within the tenant
name string
Name of the filter-segment
variables SegmentVariables
Variables of the filter-segment
description str
Description of the filter-segment
includes SegmentIncludesArgs
List of includes of the filter-segment
is_public bool
Indicates if the filter-segment is publicly accessible within the tenant
name str
Name of the filter-segment
variables SegmentVariablesArgs
Variables of the filter-segment
description String
Description of the filter-segment
includes Property Map
List of includes of the filter-segment
isPublic Boolean
Indicates if the filter-segment is publicly accessible within the tenant
name String
Name of the filter-segment
variables Property Map
Variables of the filter-segment

Supporting Types

SegmentIncludes
, SegmentIncludesArgs

Items []SegmentIncludesItem
TODO: No documentation available
items List<SegmentIncludesItem>
TODO: No documentation available
items SegmentIncludesItem[]
TODO: No documentation available
items Sequence[SegmentIncludesItem]
TODO: No documentation available
items List<Property Map>
TODO: No documentation available

SegmentIncludesItem
, SegmentIncludesItemArgs

DataObject This property is required. string
The data object that the filter will be applied to. Use 'alldata_object' to apply it to all dataObjects
Filter This property is required. string
Data will be filtered by this value
ApplyTos List<string>
[Experimental] The tables that the entity-filter will be applied to`
Relationship Pulumiverse.Dynatrace.Inputs.SegmentIncludesItemRelationship
[Experimental] The relationship of an include which has to be be specified when the data object is an entity view
DataObject This property is required. string
The data object that the filter will be applied to. Use 'alldata_object' to apply it to all dataObjects
Filter This property is required. string
Data will be filtered by this value
ApplyTos []string
[Experimental] The tables that the entity-filter will be applied to`
Relationship SegmentIncludesItemRelationship
[Experimental] The relationship of an include which has to be be specified when the data object is an entity view
dataObject This property is required. String
The data object that the filter will be applied to. Use 'alldata_object' to apply it to all dataObjects
filter This property is required. String
Data will be filtered by this value
applyTos List<String>
[Experimental] The tables that the entity-filter will be applied to`
relationship SegmentIncludesItemRelationship
[Experimental] The relationship of an include which has to be be specified when the data object is an entity view
dataObject This property is required. string
The data object that the filter will be applied to. Use 'alldata_object' to apply it to all dataObjects
filter This property is required. string
Data will be filtered by this value
applyTos string[]
[Experimental] The tables that the entity-filter will be applied to`
relationship SegmentIncludesItemRelationship
[Experimental] The relationship of an include which has to be be specified when the data object is an entity view
data_object This property is required. str
The data object that the filter will be applied to. Use 'alldata_object' to apply it to all dataObjects
filter This property is required. str
Data will be filtered by this value
apply_tos Sequence[str]
[Experimental] The tables that the entity-filter will be applied to`
relationship SegmentIncludesItemRelationship
[Experimental] The relationship of an include which has to be be specified when the data object is an entity view
dataObject This property is required. String
The data object that the filter will be applied to. Use 'alldata_object' to apply it to all dataObjects
filter This property is required. String
Data will be filtered by this value
applyTos List<String>
[Experimental] The tables that the entity-filter will be applied to`
relationship Property Map
[Experimental] The relationship of an include which has to be be specified when the data object is an entity view

SegmentIncludesItemRelationship
, SegmentIncludesItemRelationshipArgs

Name This property is required. string
Name of the relationship
Target This property is required. string
Target of the relationship
Name This property is required. string
Name of the relationship
Target This property is required. string
Target of the relationship
name This property is required. String
Name of the relationship
target This property is required. String
Target of the relationship
name This property is required. string
Name of the relationship
target This property is required. string
Target of the relationship
name This property is required. str
Name of the relationship
target This property is required. str
Target of the relationship
name This property is required. String
Name of the relationship
target This property is required. String
Target of the relationship

SegmentVariables
, SegmentVariablesArgs

Type This property is required. string
Type of the variable
Value This property is required. string
Value of the variable
Type This property is required. string
Type of the variable
Value This property is required. string
Value of the variable
type This property is required. String
Type of the variable
value This property is required. String
Value of the variable
type This property is required. string
Type of the variable
value This property is required. string
Value of the variable
type This property is required. str
Type of the variable
value This property is required. str
Value of the variable
type This property is required. String
Type of the variable
value This property is required. String
Value of the variable

Package Details

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