diff --git a/datadog/dashboardmapping/widgets.go b/datadog/dashboardmapping/widgets.go
index 6778949a27..c4a9e9a52a 100644
--- a/datadog/dashboardmapping/widgets.go
+++ b/datadog/dashboardmapping/widgets.go
@@ -688,6 +688,13 @@ var TimeseriesWidgetSpec = WidgetSpec{
Description: "A nested block describing the right Y-Axis Controls. See the `on_right_yaxis` property for which request will use this axis. The structure of this block is described below.",
Children: widgetAxisFields,
},
+ {
+ HCLKey: "anomaly_detection",
+ Type: TypeBlock,
+ OmitEmpty: true,
+ Description: "Anomaly detection configuration for this widget.",
+ Children: timeseriesWidgetAnomalyDetectionFields,
+ },
// WidgetMarker: HCL singular "marker" → JSON plural "markers"
{
HCLKey: "marker",
@@ -1630,6 +1637,19 @@ var timeseriesWidgetRequestStyleFields = []FieldSpec{
},
}
+// timeseriesWidgetAnomalyDetectionFields corresponds to OpenAPI
+// components/schemas/TimeseriesWidgetAnomalyDetection.
+var timeseriesWidgetAnomalyDetectionFields = []FieldSpec{
+ {
+ HCLKey: "detection_sensitivity",
+ Type: TypeString,
+ OmitEmpty: false,
+ Required: true,
+ Description: "Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection.",
+ ValidValues: []string{"never_detect"},
+ },
+}
+
// timeseriesWidgetMetadataFields corresponds to the inline metadata object
// on TimeseriesWidgetRequest (no standalone OpenAPI $ref; defined inline).
var timeseriesWidgetMetadataFields = []FieldSpec{
diff --git a/datadog/tests/provider_test.go b/datadog/tests/provider_test.go
index 67949fffea..109a74f144 100644
--- a/datadog/tests/provider_test.go
+++ b/datadog/tests/provider_test.go
@@ -194,6 +194,7 @@ var testFiles2EndpointTags = map[string]string{
"tests/resource_datadog_dashboard_v2_toplist_display_test": "dashboards",
"tests/resource_datadog_dashboard_v2_query_value_conditional_formats_test": "dashboards",
"tests/resource_datadog_dashboard_v2_timeseries_legend_columns_test": "dashboards",
+ "tests/resource_datadog_dashboard_v2_timeseries_anomaly_detection_test": "dashboards",
"tests/resource_datadog_dashboard_v2_tab_test": "dashboards",
"tests/resource_datadog_dashboard_v2_treemap_style_sort_test": "dashboards",
"tests/resource_datadog_dashboard_v2_sunburst_sort_test": "dashboards",
diff --git a/datadog/tests/resource_datadog_dashboard_v2_timeseries_anomaly_detection_test.go b/datadog/tests/resource_datadog_dashboard_v2_timeseries_anomaly_detection_test.go
new file mode 100644
index 0000000000..4f65c30558
--- /dev/null
+++ b/datadog/tests/resource_datadog_dashboard_v2_timeseries_anomaly_detection_test.go
@@ -0,0 +1,56 @@
+package test
+
+import (
+ "testing"
+)
+
+const datadogDashboardV2TimeseriesAnomalyDetectionConfig = `
+resource "datadog_dashboard_v2" "timeseries_anomaly_detection_dashboard" {
+ title = "{{uniq}}"
+ layout_type = "ordered"
+
+ widget {
+ timeseries_definition {
+ title = "CPU with anomaly detection"
+
+ anomaly_detection {
+ detection_sensitivity = "never_detect"
+ }
+
+ request {
+ formula {
+ formula_expression = "query1"
+ }
+
+ query {
+ metric_query {
+ data_source = "metrics"
+ name = "query1"
+ query = "avg:system.cpu.user{*}"
+ }
+ }
+ }
+ }
+ }
+}
+`
+
+var datadogDashboardV2TimeseriesAnomalyDetectionAsserts = []string{
+ "title = {{uniq}}",
+ "widget.0.timeseries_definition.0.title = CPU with anomaly detection",
+ "widget.0.timeseries_definition.0.anomaly_detection.0.detection_sensitivity = never_detect",
+ "widget.0.timeseries_definition.0.request.0.formula.0.formula_expression = query1",
+ "widget.0.timeseries_definition.0.request.0.query.0.metric_query.0.data_source = metrics",
+ "widget.0.timeseries_definition.0.request.0.query.0.metric_query.0.name = query1",
+ "widget.0.timeseries_definition.0.request.0.query.0.metric_query.0.query = avg:system.cpu.user{*}",
+}
+
+func TestAccDatadogDashboardV2TimeseriesAnomalyDetection(t *testing.T) {
+ config, name := datadogDashboardV2TimeseriesAnomalyDetectionConfig, "datadog_dashboard_v2.timeseries_anomaly_detection_dashboard"
+ testAccDatadogDashboardV2WidgetUtil(t, "TestAccDatadogDashboardV2TimeseriesAnomalyDetection", config, name, datadogDashboardV2TimeseriesAnomalyDetectionAsserts)
+}
+
+func TestAccDatadogDashboardV2TimeseriesAnomalyDetection_import(t *testing.T) {
+ config, name := datadogDashboardV2TimeseriesAnomalyDetectionConfig, "datadog_dashboard_v2.timeseries_anomaly_detection_dashboard"
+ testAccDatadogDashboardV2WidgetUtilImport(t, "TestAccDatadogDashboardV2TimeseriesAnomalyDetection_import", config, name)
+}
diff --git a/docs/resources/dashboard_v2.md b/docs/resources/dashboard_v2.md
index 3a4a975425..2ef1e61e33 100644
--- a/docs/resources/dashboard_v2.md
+++ b/docs/resources/dashboard_v2.md
@@ -13523,6 +13523,7 @@ Required:
Optional:
+- `anomaly_detection` (Block List, Max: 1) Anomaly detection configuration for this widget. (see [below for nested schema](#nestedblock--widget--group_definition--widget--timeseries_definition--anomaly_detection))
- `custom_link` (Block List) A nested block describing a custom link. Multiple `custom_link` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--timeseries_definition--custom_link))
- `description` (String) The description of the widget.
- `event` (Block List) The definition of the event to overlay on the graph. Multiple `event` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--timeseries_definition--event))
@@ -13541,6 +13542,14 @@ Optional:
- `title_size` (String) The size of the widget's title (defaults to 16).
- `yaxis` (Block List, Max: 1) A nested block describing the Y-Axis Controls. The structure of this block is described below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--timeseries_definition--yaxis))
+
+### Nested Schema for `widget.group_definition.widget.timeseries_definition.anomaly_detection`
+
+Required:
+
+- `detection_sensitivity` (String) Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection. Valid values are `never_detect`.
+
+
### Nested Schema for `widget.group_definition.widget.timeseries_definition.custom_link`
@@ -28800,6 +28809,7 @@ Required:
Optional:
+- `anomaly_detection` (Block List, Max: 1) Anomaly detection configuration for this widget. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--timeseries_definition--anomaly_detection))
- `custom_link` (Block List) A nested block describing a custom link. Multiple `custom_link` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--timeseries_definition--custom_link))
- `description` (String) The description of the widget.
- `event` (Block List) The definition of the event to overlay on the graph. Multiple `event` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--timeseries_definition--event))
@@ -28818,6 +28828,14 @@ Optional:
- `title_size` (String) The size of the widget's title (defaults to 16).
- `yaxis` (Block List, Max: 1) A nested block describing the Y-Axis Controls. The structure of this block is described below. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--timeseries_definition--yaxis))
+
+### Nested Schema for `widget.split_graph_definition.source_widget_definition.timeseries_definition.anomaly_detection`
+
+Required:
+
+- `detection_sensitivity` (String) Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection. Valid values are `never_detect`.
+
+
### Nested Schema for `widget.split_graph_definition.source_widget_definition.timeseries_definition.custom_link`
@@ -31975,6 +31993,7 @@ Required:
Optional:
+- `anomaly_detection` (Block List, Max: 1) Anomaly detection configuration for this widget. (see [below for nested schema](#nestedblock--widget--timeseries_definition--anomaly_detection))
- `custom_link` (Block List) A nested block describing a custom link. Multiple `custom_link` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--timeseries_definition--custom_link))
- `description` (String) The description of the widget.
- `event` (Block List) The definition of the event to overlay on the graph. Multiple `event` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--timeseries_definition--event))
@@ -31993,6 +32012,14 @@ Optional:
- `title_size` (String) The size of the widget's title (defaults to 16).
- `yaxis` (Block List, Max: 1) A nested block describing the Y-Axis Controls. The structure of this block is described below. (see [below for nested schema](#nestedblock--widget--timeseries_definition--yaxis))
+
+### Nested Schema for `widget.timeseries_definition.anomaly_detection`
+
+Required:
+
+- `detection_sensitivity` (String) Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection. Valid values are `never_detect`.
+
+
### Nested Schema for `widget.timeseries_definition.custom_link`
diff --git a/docs/resources/powerpack_v2.md b/docs/resources/powerpack_v2.md
index ed5d946f52..3355ce102e 100644
--- a/docs/resources/powerpack_v2.md
+++ b/docs/resources/powerpack_v2.md
@@ -13400,6 +13400,7 @@ Required:
Optional:
+- `anomaly_detection` (Block List, Max: 1) Anomaly detection configuration for this widget. (see [below for nested schema](#nestedblock--widget--group_definition--widget--timeseries_definition--anomaly_detection))
- `custom_link` (Block List) A nested block describing a custom link. Multiple `custom_link` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--timeseries_definition--custom_link))
- `description` (String) The description of the widget.
- `event` (Block List) The definition of the event to overlay on the graph. Multiple `event` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--timeseries_definition--event))
@@ -13418,6 +13419,14 @@ Optional:
- `title_size` (String) The size of the widget's title (defaults to 16).
- `yaxis` (Block List, Max: 1) A nested block describing the Y-Axis Controls. The structure of this block is described below. (see [below for nested schema](#nestedblock--widget--group_definition--widget--timeseries_definition--yaxis))
+
+### Nested Schema for `widget.group_definition.widget.timeseries_definition.anomaly_detection`
+
+Required:
+
+- `detection_sensitivity` (String) Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection. Valid values are `never_detect`.
+
+
### Nested Schema for `widget.group_definition.widget.timeseries_definition.custom_link`
@@ -24176,6 +24185,7 @@ Required:
Optional:
+- `anomaly_detection` (Block List, Max: 1) Anomaly detection configuration for this widget. (see [below for nested schema](#nestedblock--widget--timeseries_definition--anomaly_detection))
- `custom_link` (Block List) A nested block describing a custom link. Multiple `custom_link` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--timeseries_definition--custom_link))
- `description` (String) The description of the widget.
- `event` (Block List) The definition of the event to overlay on the graph. Multiple `event` blocks are allowed using the structure below. (see [below for nested schema](#nestedblock--widget--timeseries_definition--event))
@@ -24194,6 +24204,14 @@ Optional:
- `title_size` (String) The size of the widget's title (defaults to 16).
- `yaxis` (Block List, Max: 1) A nested block describing the Y-Axis Controls. The structure of this block is described below. (see [below for nested schema](#nestedblock--widget--timeseries_definition--yaxis))
+
+### Nested Schema for `widget.timeseries_definition.anomaly_detection`
+
+Required:
+
+- `detection_sensitivity` (String) Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection. Valid values are `never_detect`.
+
+
### Nested Schema for `widget.timeseries_definition.custom_link`