diff --git a/builtin/providers/datadog/resource_datadog_timeboard.go b/builtin/providers/datadog/resource_datadog_timeboard.go index e39c918f0..0597365e5 100644 --- a/builtin/providers/datadog/resource_datadog_timeboard.go +++ b/builtin/providers/datadog/resource_datadog_timeboard.go @@ -26,6 +26,15 @@ func resourceDatadogTimeboard() *schema.Resource { Optional: true, Default: false, }, + "type": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Default: "line", + }, + "style": &schema.Schema{ + Type: schema.TypeMap, + Optional: true, + }, }, }, } @@ -121,10 +130,17 @@ func appendRequests(datadogGraph *datadog.Graph, terraformRequests *[]interface{ t := t_.(map[string]interface{}) d := datadog.GraphDefinitionRequest{ Query: t["q"].(string), + Type: t["type"].(string), } if stacked, ok := t["stacked"]; ok { d.Stacked = stacked.(bool) } + if style, ok := t["style"]; ok { + s, _ := style.(map[string]interface{}) + if palette, ok := s["palette"]; ok { + d.Style.Palette = palette.(string) + } + } datadogGraph.Definition.Requests = append(datadogGraph.Definition.Requests, d) } } diff --git a/builtin/providers/datadog/resource_datadog_timeboard_test.go b/builtin/providers/datadog/resource_datadog_timeboard_test.go index e64de47cb..bd2dc7246 100644 --- a/builtin/providers/datadog/resource_datadog_timeboard_test.go +++ b/builtin/providers/datadog/resource_datadog_timeboard_test.go @@ -47,6 +47,13 @@ resource "datadog_timeboard" "acceptance_test" { request { q = "avg:redis.mem.rss{$host}" } + request { + q = "avg:redis.mem.rss{$host}" + type = "bars" + style { + palette = "warm" + } + } } template_variable { name = "host" @@ -86,6 +93,8 @@ func TestAccDatadogTimeboard_update(t *testing.T) { resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.request.1.q", "avg:redis.mem.rss{$host}"), resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "template_variable.0.name", "host"), resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "template_variable.0.prefix", "host"), + resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.request.2.type", "bars"), + resource.TestCheckResourceAttr("datadog_timeboard.acceptance_test", "graph.1.request.2.style.palette", "warm"), ), }