1. Packages
  2. Packages
  3. Dynatrace
  4. API Docs
  5. GenericSetting
Viewing docs for Dynatrace v0.36.0
published on Tuesday, Jun 9, 2026 by Pulumiverse
dynatrace logo
Viewing docs for Dynatrace v0.36.0
published on Tuesday, Jun 9, 2026 by Pulumiverse

    Dynatrace SaaS only

    This resource requires the API token scopes Read settings (settings.read) and Write settings (settings.write) In case the Platform App configured by such a settings explicitly validates them, authentication via API Token may not be enough. In such a case the environment variables DT_CLIENT_ID and DT_CLIENT_SECRET, or alternatively DT_PLATFORM_TOKEN are required. The following OAuth scopes are required app-engine:apps:run and settings:objects:write. In any case, Terraform will primarily attempt to create or modify the settings using the API Token and if that fails will utilize OAuth for authentication.

    Limitations

    Warning If a resource is created using an API token or without setting DYNATRACE_HTTP_OAUTH_PREFERENCE=true (when both are used), the settings object’s owner will remain empty.

    An empty owner implies:

    • The settings object becomes public, allowing other users with settings permissions to read and modify it.
    • Changing the settings object’s permissions will have no effect, meaning the dynatrace.SettingsPermissions resource can’t alter its access.

    When a settings object is created using platform credentials:

    • The owner is set to the owner of the OAuth client or platform token.

    If the provided schema permits modifications to access modifiers, indicated by ownerBasedAccessControl being set to true, the following statements hold true:

    • By default, the settings object is private; only the owner can read and modify it.
    • Access modifiers can be managed using the dynatrace.SettingsPermissions resource.

    We recommend using platform credentials to ensure a correct setup. In case an API token is needed, we recommend setting DYNATRACE_HTTP_OAUTH_PREFERENCE=true.

    Export Example Usage

    • terraform-provider-dynatrace -export dynatrace.GenericSetting downloads all existing settings related to Platform Apps.

    The full documentation of the export feature is available here.

    Resource Example Usage

    The actual payload of the configuration is essentially any kind of JSON object assigned to the attribute value. The scope attribute is optional and defaults to environment - which is usually the case for settings contributed by Platform Apps. You can best schema for the settings of a specific Platform App find when navigating in the WebUI to these settings and click the ellipsis button.

    import * as pulumi from "@pulumi/pulumi";
    import * as dynatrace from "@pulumiverse/dynatrace";
    
    const ABC = new dynatrace.GenericSetting("ABC", {
        schema: "app:dynatrace.site.reliability.guardian:guardians",
        scope: "environment",
        value: JSON.stringify({
            name: "#name#",
            tags: ["stage:staging"],
            eventKind: "BIZ_EVENT",
            objectives: [{
                name: "Error rate",
                comparisonOperator: "LESS_THAN_OR_EQUAL",
                dqlQuery: `fetch logs
    | fieldsAdd errors = toLong(loglevel == \\"ERROR\\")
    | summarize errorRate = sum(errors)/count() * 100
    `,
                objectiveType: "DQL",
                target: 8,
                warning: 6,
            }],
        }),
    });
    
    import pulumi
    import json
    import pulumiverse_dynatrace as dynatrace
    
    abc = dynatrace.GenericSetting("ABC",
        schema="app:dynatrace.site.reliability.guardian:guardians",
        scope="environment",
        value=json.dumps({
            "name": "#name#",
            "tags": ["stage:staging"],
            "eventKind": "BIZ_EVENT",
            "objectives": [{
                "name": "Error rate",
                "comparisonOperator": "LESS_THAN_OR_EQUAL",
                "dqlQuery": """fetch logs
    | fieldsAdd errors = toLong(loglevel == \"ERROR\")
    | summarize errorRate = sum(errors)/count() * 100
    """,
                "objectiveType": "DQL",
                "target": 8,
                "warning": 6,
            }],
        }))
    
    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{}{
    			"name": "#name#",
    			"tags": []string{
    				"stage:staging",
    			},
    			"eventKind": "BIZ_EVENT",
    			"objectives": []map[string]interface{}{
    				map[string]interface{}{
    					"name":               "Error rate",
    					"comparisonOperator": "LESS_THAN_OR_EQUAL",
    					"dqlQuery":           "fetch logs\n| fieldsAdd errors = toLong(loglevel == \\\"ERROR\\\")\n| summarize errorRate = sum(errors)/count() * 100\n",
    					"objectiveType":      "DQL",
    					"target":             8,
    					"warning":            6,
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = dynatrace.NewGenericSetting(ctx, "ABC", &dynatrace.GenericSettingArgs{
    			Schema: pulumi.String("app:dynatrace.site.reliability.guardian:guardians"),
    			Scope:  pulumi.String("environment"),
    			Value:  pulumi.String(pulumi.String(json0)),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Dynatrace = Pulumiverse.Dynatrace;
    
    return await Deployment.RunAsync(() => 
    {
        var ABC = new Dynatrace.GenericSetting("ABC", new()
        {
            Schema = "app:dynatrace.site.reliability.guardian:guardians",
            Scope = "environment",
            Value = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["name"] = "#name#",
                ["tags"] = new[]
                {
                    "stage:staging",
                },
                ["eventKind"] = "BIZ_EVENT",
                ["objectives"] = new[]
                {
                    new Dictionary<string, object?>
                    {
                        ["name"] = "Error rate",
                        ["comparisonOperator"] = "LESS_THAN_OR_EQUAL",
                        ["dqlQuery"] = @"fetch logs
    | fieldsAdd errors = toLong(loglevel == \""ERROR\"")
    | summarize errorRate = sum(errors)/count() * 100
    ",
                        ["objectiveType"] = "DQL",
                        ["target"] = 8,
                        ["warning"] = 6,
                    },
                },
            }),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.dynatrace.GenericSetting;
    import com.pulumi.dynatrace.GenericSettingArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    import java.util.ArrayList;
    import java.util.Arrays;
    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 aBC = new GenericSetting("ABC", GenericSettingArgs.builder()
                .schema("app:dynatrace.site.reliability.guardian:guardians")
                .scope("environment")
                .value(serializeJson(
                    jsonObject(
                        jsonProperty("name", "#name#"),
                        jsonProperty("tags", jsonArray("stage:staging")),
                        jsonProperty("eventKind", "BIZ_EVENT"),
                        jsonProperty("objectives", jsonArray(jsonObject(
                            jsonProperty("name", "Error rate"),
                            jsonProperty("comparisonOperator", "LESS_THAN_OR_EQUAL"),
                            jsonProperty("dqlQuery", """
    fetch logs
    | fieldsAdd errors = toLong(loglevel == \"ERROR\")
    | summarize errorRate = sum(errors)/count() * 100
                            """),
                            jsonProperty("objectiveType", "DQL"),
                            jsonProperty("target", 8),
                            jsonProperty("warning", 6)
                        )))
                    )))
                .build());
    
        }
    }
    
    resources:
      ABC:
        type: dynatrace:GenericSetting
        properties:
          schema: app:dynatrace.site.reliability.guardian:guardians
          scope: environment
          value:
            fn::toJSON:
              name: '#name#'
              tags:
                - stage:staging
              eventKind: BIZ_EVENT
              objectives:
                - name: Error rate
                  comparisonOperator: LESS_THAN_OR_EQUAL
                  dqlQuery: |
                    fetch logs
                    | fieldsAdd errors = toLong(loglevel == \"ERROR\")
                    | summarize errorRate = sum(errors)/count() * 100
                  objectiveType: DQL
                  target: 8
                  warning: 6
    
    pulumi {
      required_providers {
        dynatrace = {
          source = "pulumi/dynatrace"
        }
      }
    }
    
    resource "dynatrace_genericsetting" "ABC" {
      schema = "app:dynatrace.site.reliability.guardian:guardians"
      scope  = "environment"
      value = jsonencode({
        "name"      = "#name#"
        "tags"      = ["stage:staging"]
        "eventKind" = "BIZ_EVENT"
        "objectives" = [{
          "name"               = "Error rate"
          "comparisonOperator" = "LESS_THAN_OR_EQUAL"
          "dqlQuery"           = "fetch logs\n| fieldsAdd errors = toLong(loglevel == \\\"ERROR\\\")\n| summarize errorRate = sum(errors)/count() * 100\n"
          "objectiveType"      = "DQL"
          "target"             = 8
          "warning"            = 6
        }]
      })
    }
    

    Create GenericSetting Resource

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

    Constructor syntax

    new GenericSetting(name: string, args: GenericSettingArgs, opts?: CustomResourceOptions);
    @overload
    def GenericSetting(resource_name: str,
                       args: GenericSettingArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def GenericSetting(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       schema: Optional[str] = None,
                       value: Optional[str] = None,
                       scope: Optional[str] = None)
    func NewGenericSetting(ctx *Context, name string, args GenericSettingArgs, opts ...ResourceOption) (*GenericSetting, error)
    public GenericSetting(string name, GenericSettingArgs args, CustomResourceOptions? opts = null)
    public GenericSetting(String name, GenericSettingArgs args)
    public GenericSetting(String name, GenericSettingArgs args, CustomResourceOptions options)
    
    type: dynatrace:GenericSetting
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "dynatrace_genericsetting" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args GenericSettingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args GenericSettingArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args GenericSettingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GenericSettingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GenericSettingArgs
    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 genericSettingResource = new Dynatrace.GenericSetting("genericSettingResource", new()
    {
        Schema = "string",
        Value = "string",
        Scope = "string",
    });
    
    example, err := dynatrace.NewGenericSetting(ctx, "genericSettingResource", &dynatrace.GenericSettingArgs{
    	Schema: pulumi.String("string"),
    	Value:  pulumi.String("string"),
    	Scope:  pulumi.String("string"),
    })
    
    resource "dynatrace_genericsetting" "genericSettingResource" {
      schema = "string"
      value  = "string"
      scope  = "string"
    }
    
    var genericSettingResource = new GenericSetting("genericSettingResource", GenericSettingArgs.builder()
        .schema("string")
        .value("string")
        .scope("string")
        .build());
    
    generic_setting_resource = dynatrace.GenericSetting("genericSettingResource",
        schema="string",
        value="string",
        scope="string")
    
    const genericSettingResource = new dynatrace.GenericSetting("genericSettingResource", {
        schema: "string",
        value: "string",
        scope: "string",
    });
    
    type: dynatrace:GenericSetting
    properties:
        schema: string
        scope: string
        value: string
    

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

    Schema string
    Value string
    Scope string
    Schema string
    Value string
    Scope string
    schema string
    value string
    scope string
    schema String
    value String
    scope String
    schema string
    value string
    scope string
    schema str
    value str
    scope str
    schema String
    value String
    scope String

    Outputs

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

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

    Look up Existing GenericSetting Resource

    Get an existing GenericSetting 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?: GenericSettingState, opts?: CustomResourceOptions): GenericSetting
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            local_storage: Optional[str] = None,
            schema: Optional[str] = None,
            scope: Optional[str] = None,
            value: Optional[str] = None) -> GenericSetting
    func GetGenericSetting(ctx *Context, name string, id IDInput, state *GenericSettingState, opts ...ResourceOption) (*GenericSetting, error)
    public static GenericSetting Get(string name, Input<string> id, GenericSettingState? state, CustomResourceOptions? opts = null)
    public static GenericSetting get(String name, Output<String> id, GenericSettingState state, CustomResourceOptions options)
    resources:  _:    type: dynatrace:GenericSetting    get:      id: ${id}
    import {
      to = dynatrace_genericsetting.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    LocalStorage string
    Schema string
    Scope string
    Value string
    LocalStorage string
    Schema string
    Scope string
    Value string
    local_storage string
    schema string
    scope string
    value string
    localStorage String
    schema String
    scope String
    value String
    localStorage string
    schema string
    scope string
    value string
    localStorage String
    schema String
    scope String
    value String

    Package Details

    Repository
    dynatrace pulumiverse/pulumi-dynatrace
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the dynatrace Terraform Provider.
    dynatrace logo
    Viewing docs for Dynatrace v0.36.0
    published on Tuesday, Jun 9, 2026 by Pulumiverse

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial