From 66a57d88864379a8986c386ca028eefbb4b39da7 Mon Sep 17 00:00:00 2001 From: Pete Davids <5599894+MisterSquishy@users.noreply.github.com> Date: Wed, 3 Apr 2024 11:06:12 -0400 Subject: [PATCH] add support for comparison_window_ms in dependency maps (#220) * add support for comparison_window_ms * added terraform docs --------- Co-authored-by: MisterSquishy --- .go-version | 2 +- docs/resources/alert.md | 2 ++ docs/resources/dashboard.md | 2 ++ lightstep/resource_dashboard.go | 4 ++++ lightstep/resource_dashboard_test.go | 17 +++++++++++++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.go-version b/.go-version index dac3126..9bca308 100644 --- a/.go-version +++ b/.go-version @@ -1,2 +1,2 @@ -1.93.1 +1.93.2 diff --git a/docs/resources/alert.md b/docs/resources/alert.md index 1eac0b6..dff8c0f 100644 --- a/docs/resources/alert.md +++ b/docs/resources/alert.md @@ -207,6 +207,7 @@ Optional: Optional: +- `comparison_window_ms` (Number) - `display_type` (String) - `is_donut` (Boolean) - `sort_by` (String) @@ -275,6 +276,7 @@ Optional: Optional: +- `comparison_window_ms` (Number) - `display_type` (String) - `is_donut` (Boolean) - `sort_by` (String) diff --git a/docs/resources/dashboard.md b/docs/resources/dashboard.md index 2725888..0860c52 100644 --- a/docs/resources/dashboard.md +++ b/docs/resources/dashboard.md @@ -131,6 +131,7 @@ Optional: Optional: +- `comparison_window_ms` (Number) - `display_type` (String) - `is_donut` (Boolean) - `sort_by` (String) @@ -282,6 +283,7 @@ Optional: Optional: +- `comparison_window_ms` (Number) - `display_type` (String) - `is_donut` (Boolean) - `sort_by` (String) diff --git a/lightstep/resource_dashboard.go b/lightstep/resource_dashboard.go index 740ac32..2104825 100644 --- a/lightstep/resource_dashboard.go +++ b/lightstep/resource_dashboard.go @@ -83,6 +83,10 @@ func getUnifiedQuerySchemaMap() map[string]*schema.Schema { Type: schema.TypeBool, Optional: true, }, + "comparison_window_ms": { + Type: schema.TypeInt, + Optional: true, + }, }, }, Description: "Applicable options vary depending on the display type. Please see the Lightstep documentation for a full description.", diff --git a/lightstep/resource_dashboard_test.go b/lightstep/resource_dashboard_test.go index 868e008..906433b 100644 --- a/lightstep/resource_dashboard_test.go +++ b/lightstep/resource_dashboard_test.go @@ -1062,6 +1062,23 @@ func TestDisplayTypeOptions(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "group.0.chart.0.query.0.display_type_options.0.y_axis_max", "100"), ), }, + { + Config: makeDisplayTypeConfig("dependency_map", strings.TrimSpace(` + display_type_options { + comparison_window_ms = 86400000 + } + dependency_map_options { + map_type = "service" + scope = "all" + } +`)), + Check: resource.ComposeTestCheckFunc( + testAccCheckMetricDashboardExists(resourceName, &dashboard), + resource.TestCheckResourceAttr(resourceName, "dashboard_name", "test display_type_options"), + resource.TestCheckResourceAttr(resourceName, "group.0.chart.0.query.0.display", "dependency_map"), + resource.TestCheckResourceAttr(resourceName, "group.0.chart.0.query.0.display_type_options.0.comparison_window_ms", "86400000"), + ), + }, }, }) }