diff --git a/datadog/resource_datadog_dashboard.go b/datadog/resource_datadog_dashboard.go
index 64d6f19449..5cea958ba1 100644
--- a/datadog/resource_datadog_dashboard.go
+++ b/datadog/resource_datadog_dashboard.go
@@ -7793,6 +7793,14 @@ func getToplistDefinitionSchema() map[string]*schema.Schema {
Schema: getWidgetCustomLinkSchema(),
},
},
+ "style": {
+ Description: "The style of the widget",
+ Type: schema.TypeList,
+ Optional: true,
+ Elem: &schema.Resource{
+ Schema: getToplistWidgetStyleSchema(),
+ },
+ },
}
}
func buildDatadogToplistDefinition(terraformDefinition map[string]interface{}) *datadogV1.ToplistWidgetDefinition {
@@ -7818,8 +7826,42 @@ func buildDatadogToplistDefinition(terraformDefinition map[string]interface{}) *
if v, ok := terraformDefinition["custom_link"].([]interface{}); ok && len(v) > 0 {
datadogDefinition.SetCustomLinks(*buildDatadogWidgetCustomLinks(&v))
}
+
+ if style, ok := terraformDefinition["style"].([]interface{}); ok && len(style) > 0 {
+ if v, ok := style[0].(map[string]interface{}); ok && len(v) > 0 {
+ datadogDefinition.SetStyle(buildDatadogToplistStyle(v))
+ }
+ }
return datadogDefinition
}
+
+func buildDatadogToplistStyle(terraformToplistStyle map[string]interface{}) datadogV1.ToplistWidgetStyle {
+ datadogToplistStyle := datadogV1.NewToplistWidgetStyleWithDefaults()
+
+ if display, ok := terraformToplistStyle["display"].([]interface{}); ok && len(display) > 0 {
+ if v, ok := display[0].(map[string]interface{}); ok && len(v) > 0 {
+ if t, ok := v["type"].(string); ok && len(t) != 0 {
+ if t == "stacked" {
+ datadogToplistStyle.SetDisplay(datadogV1.ToplistWidgetDisplay{
+ ToplistWidgetStacked: datadogV1.NewToplistWidgetStacked(
+ datadogV1.TOPLISTWIDGETLEGEND_AUTOMATIC,
+ datadogV1.TOPLISTWIDGETSTACKEDTYPE_STACKED,
+ ),
+ })
+ } else if t == "flat" {
+ datadogToplistStyle.SetDisplay(datadogV1.ToplistWidgetDisplay{
+ ToplistWidgetFlat: datadogV1.NewToplistWidgetFlatWithDefaults(),
+ })
+ }
+ }
+ }
+ }
+ if palette, ok := terraformToplistStyle["palette"].(string); ok && len(palette) != 0 {
+ datadogToplistStyle.SetPalette(palette)
+ }
+ return *datadogToplistStyle
+}
+
func buildTerraformToplistDefinition(datadogDefinition *datadogV1.ToplistWidgetDefinition) map[string]interface{} {
terraformDefinition := map[string]interface{}{}
// Required params
@@ -7841,6 +7883,9 @@ func buildTerraformToplistDefinition(datadogDefinition *datadogV1.ToplistWidgetD
if v, ok := datadogDefinition.GetCustomLinksOk(); ok {
terraformDefinition["custom_link"] = buildTerraformWidgetCustomLinks(v)
}
+ if v, ok := datadogDefinition.GetStyleOk(); ok {
+ terraformDefinition["style"] = buildTerraformToplistWidgetStyle(v)
+ }
return terraformDefinition
}
@@ -7993,6 +8038,27 @@ func buildTerraformToplistRequests(datadogToplistRequests *[]datadogV1.ToplistWi
return &terraformRequests
}
+func buildTerraformToplistWidgetStyle(datadogToplistStyle *datadogV1.ToplistWidgetStyle) *[]map[string]interface{} {
+ terraformStyles := make([]map[string]interface{}, 1)
+ terraformStyle := map[string]interface{}{}
+ if display, ok := datadogToplistStyle.GetDisplayOk(); ok {
+ terraformDisplays := make([]map[string]interface{}, 1)
+ terraformDisplay := map[string]interface{}{}
+ if display.ToplistWidgetStacked != nil {
+ terraformDisplay["type"] = datadogV1.TOPLISTWIDGETSTACKEDTYPE_STACKED
+ } else if display.ToplistWidgetFlat != nil {
+ terraformDisplay["type"] = datadogV1.TOPLISTWIDGETFLATTYPE_FLAT
+ }
+ terraformDisplays[0] = terraformDisplay
+ terraformStyle["display"] = terraformDisplays
+ }
+ if palette, ok := datadogToplistStyle.GetPaletteOk(); ok {
+ terraformStyle["palette"] = palette
+ }
+ terraformStyles[0] = terraformStyle
+ return &terraformStyles
+}
+
//
// Trace Service Widget Definition helpers
//
@@ -9150,6 +9216,38 @@ func getWidgetCustomLinkSchema() map[string]*schema.Schema {
}
}
+// Toplist Widget Style helpers
+
+func getToplistWidgetStyleSchema() map[string]*schema.Schema {
+ return map[string]*schema.Schema{
+ "display": {
+ Description: "The display mode for the widget.",
+ Type: schema.TypeList,
+ Optional: true,
+ Elem: &schema.Resource{
+ Schema: getWidgetDisplaySchema(),
+ },
+ },
+ "palette": {
+ Description: "The color palette for the widget.",
+ Type: schema.TypeString,
+ Optional: true,
+ },
+ }
+}
+
+// Widget Display helper
+
+func getWidgetDisplaySchema() map[string]*schema.Schema {
+ return map[string]*schema.Schema{
+ "type": {
+ Description: "The display type for the widget.",
+ Type: schema.TypeString,
+ Required: true,
+ },
+ }
+}
+
func buildDatadogTimeseriesBackground(terraformTimeseriesBackground map[string]interface{}) *datadogV1.TimeseriesBackground {
datadogTimeseriesBackground := &datadogV1.TimeseriesBackground{}
if v, ok := terraformTimeseriesBackground["type"].(string); ok && len(v) != 0 {
diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopListWithStyle.freeze b/datadog/tests/cassettes/TestAccDatadogDashboardTopListWithStyle.freeze
new file mode 100644
index 0000000000..747ca2d19d
--- /dev/null
+++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopListWithStyle.freeze
@@ -0,0 +1 @@
+2024-09-08T22:06:13.597382-04:00
\ No newline at end of file
diff --git a/datadog/tests/cassettes/TestAccDatadogDashboardTopListWithStyle.yaml b/datadog/tests/cassettes/TestAccDatadogDashboardTopListWithStyle.yaml
new file mode 100644
index 0000000000..64dbd6eb1b
--- /dev/null
+++ b/datadog/tests/cassettes/TestAccDatadogDashboardTopListWithStyle.yaml
@@ -0,0 +1,215 @@
+---
+version: 2
+interactions:
+ - id: 0
+ request:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ content_length: 1453
+ transfer_encoding: []
+ trailer: {}
+ host: api.datadoghq.com
+ remote_addr: ""
+ request_uri: ""
+ body: |
+ {"description":"Created using the Datadog provider in Terraform","id":"","is_read_only":true,"layout_type":"ordered","notify_list":[],"tags":[],"template_variable_presets":[],"template_variables":[],"title":"tf-TestAccDatadogDashboardTopListWithStyle-local-1725847573","widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":"\u003e","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"type":"flat"}},"time":{"live_span":"1w"},"title":"Toplist with flat style","title_align":"right","title_size":"16","type":"toplist"}},{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":"\u003e","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"legend":"automatic","type":"stacked"},"palette":"datadog16"},"time":{"live_span":"1w"},"title":"Toplist with stacked style","title_align":"right","title_size":"16","type":"toplist"}}]}
+ form: {}
+ headers:
+ Accept:
+ - application/json
+ Content-Type:
+ - application/json
+ url: https://api.datadoghq.com/api/v1/dashboard
+ method: POST
+ response:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ transfer_encoding:
+ - chunked
+ trailer: {}
+ content_length: -1
+ uncompressed: true
+ body: |
+ {"id":"xr5-ybv-k7p","title":"tf-TestAccDatadogDashboardTopListWithStyle-local-1725847573","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/xr5-ybv-k7p/tf-testaccdatadogdashboardtoplistwithstyle-local-1725847573","is_read_only":true,"template_variables":[],"widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":">","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"type":"flat"}},"time":{"live_span":"1w"},"title":"Toplist with flat style","title_align":"right","title_size":"16","type":"toplist"},"id":6874455526830069},{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":">","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"legend":"automatic","type":"stacked"},"palette":"datadog16"},"time":{"live_span":"1w"},"title":"Toplist with stacked style","title_align":"right","title_size":"16","type":"toplist"},"id":4085304145087860}],"notify_list":[],"created_at":"2024-09-09T02:06:15.930563+00:00","modified_at":"2024-09-09T02:06:15.930563+00:00","template_variable_presets":[],"tags":[]}
+ headers:
+ Content-Type:
+ - application/json
+ status: 200 OK
+ code: 200
+ duration: 394.23525ms
+ - id: 1
+ request:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ content_length: 0
+ transfer_encoding: []
+ trailer: {}
+ host: api.datadoghq.com
+ remote_addr: ""
+ request_uri: ""
+ body: ""
+ form: {}
+ headers:
+ Accept:
+ - application/json
+ url: https://api.datadoghq.com/api/v1/dashboard/xr5-ybv-k7p
+ method: GET
+ response:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ transfer_encoding:
+ - chunked
+ trailer: {}
+ content_length: -1
+ uncompressed: true
+ body: |
+ {"id":"xr5-ybv-k7p","title":"tf-TestAccDatadogDashboardTopListWithStyle-local-1725847573","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/xr5-ybv-k7p/tf-testaccdatadogdashboardtoplistwithstyle-local-1725847573","is_read_only":true,"template_variables":[],"widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":">","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"type":"flat"}},"time":{"live_span":"1w"},"title":"Toplist with flat style","title_align":"right","title_size":"16","type":"toplist"},"id":6874455526830069},{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":">","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"legend":"automatic","type":"stacked"},"palette":"datadog16"},"time":{"live_span":"1w"},"title":"Toplist with stacked style","title_align":"right","title_size":"16","type":"toplist"},"id":4085304145087860}],"notify_list":[],"created_at":"2024-09-09T02:06:15.930563+00:00","modified_at":"2024-09-09T02:06:15.930563+00:00","template_variable_presets":[],"tags":[]}
+ headers:
+ Content-Type:
+ - application/json
+ status: 200 OK
+ code: 200
+ duration: 97.972417ms
+ - id: 2
+ request:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ content_length: 0
+ transfer_encoding: []
+ trailer: {}
+ host: api.datadoghq.com
+ remote_addr: ""
+ request_uri: ""
+ body: ""
+ form: {}
+ headers:
+ Accept:
+ - application/json
+ url: https://api.datadoghq.com/api/v1/dashboard/xr5-ybv-k7p
+ method: GET
+ response:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ transfer_encoding:
+ - chunked
+ trailer: {}
+ content_length: -1
+ uncompressed: true
+ body: |
+ {"id":"xr5-ybv-k7p","title":"tf-TestAccDatadogDashboardTopListWithStyle-local-1725847573","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/xr5-ybv-k7p/tf-testaccdatadogdashboardtoplistwithstyle-local-1725847573","is_read_only":true,"template_variables":[],"widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":">","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"type":"flat"}},"time":{"live_span":"1w"},"title":"Toplist with flat style","title_align":"right","title_size":"16","type":"toplist"},"id":6874455526830069},{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":">","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"legend":"automatic","type":"stacked"},"palette":"datadog16"},"time":{"live_span":"1w"},"title":"Toplist with stacked style","title_align":"right","title_size":"16","type":"toplist"},"id":4085304145087860}],"notify_list":[],"created_at":"2024-09-09T02:06:15.930563+00:00","modified_at":"2024-09-09T02:06:15.930563+00:00","template_variable_presets":[],"tags":[]}
+ headers:
+ Content-Type:
+ - application/json
+ status: 200 OK
+ code: 200
+ duration: 126.133375ms
+ - id: 3
+ request:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ content_length: 0
+ transfer_encoding: []
+ trailer: {}
+ host: api.datadoghq.com
+ remote_addr: ""
+ request_uri: ""
+ body: ""
+ form: {}
+ headers:
+ Accept:
+ - application/json
+ url: https://api.datadoghq.com/api/v1/dashboard/xr5-ybv-k7p
+ method: GET
+ response:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ transfer_encoding:
+ - chunked
+ trailer: {}
+ content_length: -1
+ uncompressed: true
+ body: |
+ {"id":"xr5-ybv-k7p","title":"tf-TestAccDatadogDashboardTopListWithStyle-local-1725847573","description":"Created using the Datadog provider in Terraform","author_handle":"frog@datadoghq.com","author_name":null,"layout_type":"ordered","url":"/dashboard/xr5-ybv-k7p/tf-testaccdatadogdashboardtoplistwithstyle-local-1725847573","is_read_only":true,"template_variables":[],"widgets":[{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":">","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"type":"flat"}},"time":{"live_span":"1w"},"title":"Toplist with flat style","title_align":"right","title_size":"16","type":"toplist"},"id":6874455526830069},{"definition":{"custom_links":[{"label":"Test Custom Link label","link":"https://app.datadoghq.com/dashboard/lists"},{"is_hidden":true,"link":"https://app.datadoghq.com/dashboard/lists","override_label":"logs"}],"requests":[{"conditional_formats":[{"comparator":">","hide_value":false,"palette":"white_on_red","value":15000}],"q":"top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"}],"style":{"display":{"legend":"automatic","type":"stacked"},"palette":"datadog16"},"time":{"live_span":"1w"},"title":"Toplist with stacked style","title_align":"right","title_size":"16","type":"toplist"},"id":4085304145087860}],"notify_list":[],"created_at":"2024-09-09T02:06:15.930563+00:00","modified_at":"2024-09-09T02:06:15.930563+00:00","template_variable_presets":[],"tags":[]}
+ headers:
+ Content-Type:
+ - application/json
+ status: 200 OK
+ code: 200
+ duration: 113.903708ms
+ - id: 4
+ request:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ content_length: 0
+ transfer_encoding: []
+ trailer: {}
+ host: api.datadoghq.com
+ remote_addr: ""
+ request_uri: ""
+ body: ""
+ form: {}
+ headers:
+ Accept:
+ - application/json
+ url: https://api.datadoghq.com/api/v1/dashboard/xr5-ybv-k7p
+ method: DELETE
+ response:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ transfer_encoding:
+ - chunked
+ trailer: {}
+ content_length: -1
+ uncompressed: true
+ body: |
+ {"deleted_dashboard_id":"xr5-ybv-k7p"}
+ headers:
+ Content-Type:
+ - application/json
+ status: 200 OK
+ code: 200
+ duration: 170.26275ms
+ - id: 5
+ request:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ content_length: 0
+ transfer_encoding: []
+ trailer: {}
+ host: api.datadoghq.com
+ remote_addr: ""
+ request_uri: ""
+ body: ""
+ form: {}
+ headers:
+ Accept:
+ - application/json
+ url: https://api.datadoghq.com/api/v1/dashboard/xr5-ybv-k7p
+ method: GET
+ response:
+ proto: HTTP/1.1
+ proto_major: 1
+ proto_minor: 1
+ transfer_encoding:
+ - chunked
+ trailer: {}
+ content_length: -1
+ uncompressed: true
+ body: '{"errors":["Dashboard with ID xr5-ybv-k7p not found"]}'
+ headers:
+ Content-Type:
+ - application/json
+ status: 404 Not Found
+ code: 404
+ duration: 86.552916ms
diff --git a/datadog/tests/resource_datadog_dashboard_top_list_test.go b/datadog/tests/resource_datadog_dashboard_top_list_test.go
index 5ec66cd868..bbd852afeb 100644
--- a/datadog/tests/resource_datadog_dashboard_top_list_test.go
+++ b/datadog/tests/resource_datadog_dashboard_top_list_test.go
@@ -134,6 +134,78 @@ resource "datadog_dashboard" "top_list_dashboard" {
}
`
+const datadogDashboardTopListConfigWithStyle = `
+resource "datadog_dashboard" "top_list_dashboard" {
+ title = "{{uniq}}"
+ description = "Created using the Datadog provider in Terraform"
+ layout_type = "ordered"
+ is_read_only = "true"
+
+ widget {
+ toplist_definition {
+ title_size = "16"
+ title = "Toplist with flat style"
+ title_align = "right"
+ live_span = "1w"
+ request {
+ q = "top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"
+ conditional_formats {
+ palette = "white_on_red"
+ value = 15000
+ comparator = ">"
+ }
+ }
+ custom_link {
+ link = "https://app.datadoghq.com/dashboard/lists"
+ label = "Test Custom Link label"
+ }
+ custom_link {
+ link = "https://app.datadoghq.com/dashboard/lists"
+ is_hidden = true
+ override_label = "logs"
+ }
+ style {
+ display {
+ type = "flat"
+ }
+ }
+ }
+ }
+
+ widget {
+ toplist_definition {
+ title_size = "16"
+ title = "Toplist with stacked style"
+ title_align = "right"
+ live_span = "1w"
+ request {
+ q = "top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')"
+ conditional_formats {
+ palette = "white_on_red"
+ value = 15000
+ comparator = ">"
+ }
+ }
+ custom_link {
+ link = "https://app.datadoghq.com/dashboard/lists"
+ label = "Test Custom Link label"
+ }
+ custom_link {
+ link = "https://app.datadoghq.com/dashboard/lists"
+ is_hidden = true
+ override_label = "logs"
+ }
+ style {
+ display {
+ type = "stacked"
+ }
+ palette = "datadog16"
+ }
+ }
+ }
+}
+`
+
var datadogDashboardTopListAsserts = []string{
"description = Created using the Datadog provider in Terraform",
"widget.0.toplist_definition.0.request.0.conditional_formats.0.timeframe =",
@@ -188,6 +260,62 @@ var datadogDashboardTopListFormulaAsserts = []string{
"widget.1.toplist_definition.0.request.0.query.0.event_query.0.compute.0.aggregation = count",
}
+var datadogDashboardTopListAssertsWithStyle = []string{
+ "title = {{uniq}}",
+ "description = Created using the Datadog provider in Terraform",
+ "layout_type = ordered",
+ "is_read_only = true",
+
+ "widget.0.toplist_definition.0.request.0.conditional_formats.0.timeframe =",
+ "widget.0.toplist_definition.0.request.0.conditional_formats.0.image_url =",
+ "widget.0.toplist_definition.0.request.0.conditional_formats.0.comparator = >",
+ "widget.0.toplist_definition.0.request.0.conditional_formats.0.custom_bg_color =",
+ "widget.0.toplist_definition.0.request.0.conditional_formats.0.palette = white_on_red",
+ "widget.0.toplist_definition.0.live_span = 1w",
+ "widget.0.toplist_definition.0.time.% = 0",
+ "widget.0.toplist_definition.0.request.0.conditional_formats.0.hide_value = false",
+ "widget.0.toplist_definition.0.request.0.q = top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')",
+ "widget.0.toplist_definition.0.title_size = 16",
+ "widget.0.toplist_definition.0.title_align = right",
+ "widget.0.toplist_definition.0.request.0.conditional_formats.0.value = 15000",
+ "widget.0.toplist_definition.0.title = Toplist with flat style",
+ "widget.0.toplist_definition.0.request.0.conditional_formats.0.custom_fg_color =",
+ "widget.0.toplist_definition.0.custom_link.# = 2",
+ "widget.0.toplist_definition.0.custom_link.0.label = Test Custom Link label",
+ "widget.0.toplist_definition.0.custom_link.0.link = https://app.datadoghq.com/dashboard/lists",
+ "widget.0.toplist_definition.0.custom_link.1.override_label = logs",
+ "widget.0.toplist_definition.0.custom_link.1.link = https://app.datadoghq.com/dashboard/lists",
+ "widget.0.toplist_definition.0.custom_link.1.is_hidden = true",
+ "widget.0.toplist_definition.0.style.# = 1",
+ "widget.0.toplist_definition.0.style.0.display.# = 1",
+ "widget.0.toplist_definition.0.style.0.display.0.type = flat",
+
+ "widget.1.toplist_definition.0.request.0.conditional_formats.0.timeframe =",
+ "widget.1.toplist_definition.0.request.0.conditional_formats.0.image_url =",
+ "widget.1.toplist_definition.0.request.0.conditional_formats.0.comparator = >",
+ "widget.1.toplist_definition.0.request.0.conditional_formats.0.custom_bg_color =",
+ "widget.1.toplist_definition.0.request.0.conditional_formats.0.palette = white_on_red",
+ "widget.1.toplist_definition.0.live_span = 1w",
+ "widget.1.toplist_definition.0.time.% = 0",
+ "widget.1.toplist_definition.0.request.0.conditional_formats.0.hide_value = false",
+ "widget.1.toplist_definition.0.request.0.q = top(avg:system.cpu.user{*} by {service,app_id}, 10, 'sum', 'desc')",
+ "widget.1.toplist_definition.0.title_size = 16",
+ "widget.1.toplist_definition.0.title_align = right",
+ "widget.1.toplist_definition.0.request.0.conditional_formats.0.value = 15000",
+ "widget.1.toplist_definition.0.title = Toplist with stacked style",
+ "widget.1.toplist_definition.0.request.0.conditional_formats.0.custom_fg_color =",
+ "widget.1.toplist_definition.0.custom_link.# = 2",
+ "widget.1.toplist_definition.0.custom_link.0.label = Test Custom Link label",
+ "widget.1.toplist_definition.0.custom_link.0.link = https://app.datadoghq.com/dashboard/lists",
+ "widget.1.toplist_definition.0.custom_link.1.override_label = logs",
+ "widget.1.toplist_definition.0.custom_link.1.link = https://app.datadoghq.com/dashboard/lists",
+ "widget.1.toplist_definition.0.custom_link.1.is_hidden = true",
+ "widget.1.toplist_definition.0.style.# = 1",
+ "widget.1.toplist_definition.0.style.0.display.# = 1",
+ "widget.1.toplist_definition.0.style.0.display.0.type = stacked",
+ "widget.1.toplist_definition.0.style.0.palette = datadog16",
+}
+
func TestAccDatadogDashboardTopList(t *testing.T) {
testAccDatadogDashboardWidgetUtil(t, datadogDashboardTopListConfig, "datadog_dashboard.top_list_dashboard", datadogDashboardTopListAsserts)
}
@@ -203,3 +331,7 @@ func TestAccDatadogDashboardTopListFormula(t *testing.T) {
func TestAccDatadogDashboardTopListFormula_import(t *testing.T) {
testAccDatadogDashboardWidgetUtilImport(t, datadogDashboardTopListFormulaConfig, "datadog_dashboard.top_list_dashboard")
}
+
+func TestAccDatadogDashboardTopListWithStyle(t *testing.T) {
+ testAccDatadogDashboardWidgetUtil(t, datadogDashboardTopListConfigWithStyle, "datadog_dashboard.top_list_dashboard", datadogDashboardTopListAssertsWithStyle)
+}
diff --git a/docs/resources/dashboard.md b/docs/resources/dashboard.md
index 44798417a0..f5dff4e999 100644
--- a/docs/resources/dashboard.md
+++ b/docs/resources/dashboard.md
@@ -11998,6 +11998,7 @@ Optional:
- `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--split_graph_definition--source_widget_definition--toplist_definition--custom_link))
- `live_span` (String) The timeframe to use when displaying the widget. Valid values are `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `4h`, `1d`, `2d`, `1w`, `1mo`, `3mo`, `6mo`, `week_to_date`, `month_to_date`, `1y`, `alert`.
- `request` (Block List) A nested block describing the request to use when displaying the widget. Multiple `request` blocks are allowed using the structure below (exactly one of `q`, `apm_query`, `log_query`, `rum_query`, `security_query` or `process_query` is required within the `request` block). (see [below for nested schema](#nestedblock--widget--group_definition--widget--split_graph_definition--source_widget_definition--toplist_definition--request))
+- `style` (Block List) The style of the widget (see [below for nested schema](#nestedblock--widget--group_definition--widget--split_graph_definition--source_widget_definition--toplist_definition--style))
- `title` (String) The title of the widget.
- `title_align` (String) The alignment of the widget's title. Valid values are `center`, `left`, `right`.
- `title_size` (String) The size of the widget's title (defaults to 16).
@@ -12634,6 +12635,23 @@ Optional:
+
+### Nested Schema for `widget.group_definition.widget.split_graph_definition.source_widget_definition.toplist_definition.style`
+
+Optional:
+
+- `display` (Block List) The display mode for the widget. (see [below for nested schema](#nestedblock--widget--group_definition--widget--split_graph_definition--source_widget_definition--toplist_definition--style--display))
+- `palette` (String) The color palette for the widget.
+
+
+### Nested Schema for `widget.group_definition.widget.split_graph_definition.source_widget_definition.toplist_definition.style.display`
+
+Required:
+
+- `type` (String) The display type for the widget.
+
+
+
### Nested Schema for `widget.group_definition.widget.split_graph_definition.source_widget_definition.treemap_definition`
@@ -14446,6 +14464,7 @@ Optional:
- `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--toplist_definition--custom_link))
- `live_span` (String) The timeframe to use when displaying the widget. Valid values are `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `4h`, `1d`, `2d`, `1w`, `1mo`, `3mo`, `6mo`, `week_to_date`, `month_to_date`, `1y`, `alert`.
- `request` (Block List) A nested block describing the request to use when displaying the widget. Multiple `request` blocks are allowed using the structure below (exactly one of `q`, `apm_query`, `log_query`, `rum_query`, `security_query` or `process_query` is required within the `request` block). (see [below for nested schema](#nestedblock--widget--group_definition--widget--toplist_definition--request))
+- `style` (Block List) The style of the widget (see [below for nested schema](#nestedblock--widget--group_definition--widget--toplist_definition--style))
- `title` (String) The title of the widget.
- `title_align` (String) The alignment of the widget's title. Valid values are `center`, `left`, `right`.
- `title_size` (String) The size of the widget's title (defaults to 16).
@@ -15082,6 +15101,23 @@ Optional:
+
+### Nested Schema for `widget.group_definition.widget.toplist_definition.style`
+
+Optional:
+
+- `display` (Block List) The display mode for the widget. (see [below for nested schema](#nestedblock--widget--group_definition--widget--toplist_definition--style--display))
+- `palette` (String) The color palette for the widget.
+
+
+### Nested Schema for `widget.group_definition.widget.toplist_definition.style.display`
+
+Required:
+
+- `type` (String) The display type for the widget.
+
+
+
### Nested Schema for `widget.group_definition.widget.topology_map_definition`
@@ -23692,6 +23728,7 @@ Optional:
- `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--toplist_definition--custom_link))
- `live_span` (String) The timeframe to use when displaying the widget. Valid values are `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `4h`, `1d`, `2d`, `1w`, `1mo`, `3mo`, `6mo`, `week_to_date`, `month_to_date`, `1y`, `alert`.
- `request` (Block List) A nested block describing the request to use when displaying the widget. Multiple `request` blocks are allowed using the structure below (exactly one of `q`, `apm_query`, `log_query`, `rum_query`, `security_query` or `process_query` is required within the `request` block). (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--toplist_definition--request))
+- `style` (Block List) The style of the widget (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--toplist_definition--style))
- `title` (String) The title of the widget.
- `title_align` (String) The alignment of the widget's title. Valid values are `center`, `left`, `right`.
- `title_size` (String) The size of the widget's title (defaults to 16).
@@ -24328,6 +24365,23 @@ Optional:
+
+### Nested Schema for `widget.split_graph_definition.source_widget_definition.toplist_definition.style`
+
+Optional:
+
+- `display` (Block List) The display mode for the widget. (see [below for nested schema](#nestedblock--widget--split_graph_definition--source_widget_definition--toplist_definition--style--display))
+- `palette` (String) The color palette for the widget.
+
+
+### Nested Schema for `widget.split_graph_definition.source_widget_definition.toplist_definition.style.display`
+
+Required:
+
+- `type` (String) The display type for the widget.
+
+
+
### Nested Schema for `widget.split_graph_definition.source_widget_definition.treemap_definition`
@@ -26140,6 +26194,7 @@ Optional:
- `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--toplist_definition--custom_link))
- `live_span` (String) The timeframe to use when displaying the widget. Valid values are `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `4h`, `1d`, `2d`, `1w`, `1mo`, `3mo`, `6mo`, `week_to_date`, `month_to_date`, `1y`, `alert`.
- `request` (Block List) A nested block describing the request to use when displaying the widget. Multiple `request` blocks are allowed using the structure below (exactly one of `q`, `apm_query`, `log_query`, `rum_query`, `security_query` or `process_query` is required within the `request` block). (see [below for nested schema](#nestedblock--widget--toplist_definition--request))
+- `style` (Block List) The style of the widget (see [below for nested schema](#nestedblock--widget--toplist_definition--style))
- `title` (String) The title of the widget.
- `title_align` (String) The alignment of the widget's title. Valid values are `center`, `left`, `right`.
- `title_size` (String) The size of the widget's title (defaults to 16).
@@ -26776,6 +26831,23 @@ Optional:
+
+### Nested Schema for `widget.toplist_definition.style`
+
+Optional:
+
+- `display` (Block List) The display mode for the widget. (see [below for nested schema](#nestedblock--widget--toplist_definition--style--display))
+- `palette` (String) The color palette for the widget.
+
+
+### Nested Schema for `widget.toplist_definition.style.display`
+
+Required:
+
+- `type` (String) The display type for the widget.
+
+
+
### Nested Schema for `widget.topology_map_definition`
diff --git a/docs/resources/powerpack.md b/docs/resources/powerpack.md
index 3686fae29d..8b27cda084 100644
--- a/docs/resources/powerpack.md
+++ b/docs/resources/powerpack.md
@@ -6630,6 +6630,7 @@ Optional:
- `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--toplist_definition--custom_link))
- `live_span` (String) The timeframe to use when displaying the widget. Valid values are `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `4h`, `1d`, `2d`, `1w`, `1mo`, `3mo`, `6mo`, `week_to_date`, `month_to_date`, `1y`, `alert`.
- `request` (Block List) A nested block describing the request to use when displaying the widget. Multiple `request` blocks are allowed using the structure below (exactly one of `q`, `apm_query`, `log_query`, `rum_query`, `security_query` or `process_query` is required within the `request` block). (see [below for nested schema](#nestedblock--widget--toplist_definition--request))
+- `style` (Block List) The style of the widget (see [below for nested schema](#nestedblock--widget--toplist_definition--style))
- `title` (String) The title of the widget.
- `title_align` (String) The alignment of the widget's title. Valid values are `center`, `left`, `right`.
- `title_size` (String) The size of the widget's title (defaults to 16).
@@ -7266,6 +7267,23 @@ Optional:
+
+### Nested Schema for `widget.toplist_definition.style`
+
+Optional:
+
+- `display` (Block List) The display mode for the widget. (see [below for nested schema](#nestedblock--widget--toplist_definition--style--display))
+- `palette` (String) The color palette for the widget.
+
+
+### Nested Schema for `widget.toplist_definition.style.display`
+
+Required:
+
+- `type` (String) The display type for the widget.
+
+
+
### Nested Schema for `widget.topology_map_definition`