@@ -51,6 +51,8 @@ func TestAccSumologicDashboard_create(t *testing.T) {
5151 refreshInterval := 120
5252 domain := "aws"
5353 literalRangeName := "today"
54+ relativeTime := "-60m"
55+ canonicalRelativeTime := "-1h"
5456 textPanel := TextPanel {
5557 Key : "text-panel-001" ,
5658 Title : "Text Panel Title" ,
@@ -84,7 +86,7 @@ func TestAccSumologicDashboard_create(t *testing.T) {
8486 Steps : []resource.TestStep {
8587 {
8688 Config : dashboardCreateConfig (title , description , theme , refreshInterval ,
87- topologyLabel , domain , literalRangeName , textPanel , layout , variable ),
89+ topologyLabel , domain , literalRangeName , relativeTime , textPanel , layout , variable ),
8890 Check : resource .ComposeTestCheckFunc (
8991 testAccCheckDashboardExists ("sumologic_dashboard.tf_crud_test" , & dashboard , t ),
9092 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
@@ -104,6 +106,9 @@ func TestAccSumologicDashboard_create(t *testing.T) {
104106 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
105107 "time_range.0.begin_bounded_time_range.0.from.0.literal_time_range.0.range_name" ,
106108 literalRangeName ),
109+ resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
110+ "time_range.0.begin_bounded_time_range.0.to.0.relative_time_range.0.relative_time" ,
111+ canonicalRelativeTime ),
107112 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
108113 "panel.#" , "1" ),
109114 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
@@ -133,6 +138,8 @@ func TestAccSumologicDashboard_update(t *testing.T) {
133138 refreshInterval := 120
134139 domain := "aws"
135140 literalRangeName := "today"
141+ relativeTime := "-1h"
142+ canonicalRelativeTime := "-1h"
136143 textPanel := TextPanel {
137144 Key : "text-panel-001" ,
138145 Title : "Text Panel Title" ,
@@ -164,6 +171,8 @@ func TestAccSumologicDashboard_update(t *testing.T) {
164171 newFirstLabelValue := "collection-cluster"
165172 updatedDomain := "app"
166173 newLiteralRangeName := "week"
174+ newRelativeTime := "60s"
175+ canonicalNewRelativeTime := "1m"
167176 searchPanel := SumoSearchPanel {
168177 Key : "search-panel-001" ,
169178 Title : "API Errors" ,
@@ -214,7 +223,7 @@ func TestAccSumologicDashboard_update(t *testing.T) {
214223 Steps : []resource.TestStep {
215224 {
216225 Config : dashboardCreateConfig (title , description , theme , refreshInterval ,
217- topologyLabel , domain , literalRangeName , textPanel , layout , csvVariable ),
226+ topologyLabel , domain , literalRangeName , relativeTime , textPanel , layout , csvVariable ),
218227 Check : resource .ComposeTestCheckFunc (
219228 testAccCheckDashboardExists ("sumologic_dashboard.tf_crud_test" , & dashboard , t ),
220229 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
@@ -230,6 +239,9 @@ func TestAccSumologicDashboard_update(t *testing.T) {
230239 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
231240 "time_range.0.begin_bounded_time_range.0.from.0.literal_time_range.0.range_name" ,
232241 literalRangeName ),
242+ resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
243+ "time_range.0.begin_bounded_time_range.0.to.0.relative_time_range.0.relative_time" ,
244+ canonicalRelativeTime ),
233245 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
234246 "panel.#" , "1" ),
235247 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
@@ -246,7 +258,7 @@ func TestAccSumologicDashboard_update(t *testing.T) {
246258 },
247259 {
248260 Config : dashboardUpdateConfig (title , description , newTheme , newRefreshInterval ,
249- firstLabelKey , newFirstLabelValue , updatedDomain , newLiteralRangeName , textPanel ,
261+ firstLabelKey , newFirstLabelValue , updatedDomain , newLiteralRangeName , newRelativeTime , textPanel ,
250262 searchPanel , newLayout , newVariables ),
251263 Check : resource .ComposeTestCheckFunc (
252264 testAccCheckDashboardExists ("sumologic_dashboard.tf_crud_test" , & dashboard , t ),
@@ -263,6 +275,9 @@ func TestAccSumologicDashboard_update(t *testing.T) {
263275 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
264276 "time_range.0.begin_bounded_time_range.0.from.0.literal_time_range.0.range_name" ,
265277 newLiteralRangeName ),
278+ resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
279+ "time_range.0.begin_bounded_time_range.0.to.0.relative_time_range.0.relative_time" ,
280+ canonicalNewRelativeTime ),
266281 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
267282 "panel.#" , "2" ),
268283 resource .TestCheckResourceAttr ("sumologic_dashboard.tf_crud_test" ,
@@ -412,7 +427,7 @@ func dashboardImportConfig(title string) string {
412427}
413428
414429func dashboardCreateConfig (title string , description string , theme string , refreshInterval int ,
415- topologyLabel TopologyLabel , domain string , rangeName string , textPanel TextPanel ,
430+ topologyLabel TopologyLabel , domain string , rangeName string , relativeTime string , textPanel TextPanel ,
416431 layout GridLayout , variable Variable ) string {
417432
418433 return fmt .Sprintf (`
@@ -441,6 +456,12 @@ func dashboardCreateConfig(title string, description string, theme string, refre
441456 range_name = "%s"
442457 }
443458 }
459+
460+ to {
461+ relative_time_range {
462+ relative_time = "%s"
463+ }
464+ }
444465 }
445466 }
446467 panel {
@@ -476,14 +497,14 @@ func dashboardCreateConfig(title string, description string, theme string, refre
476497 }` ,
477498 title , description , refreshInterval , theme , firstLabelKey , topologyLabel .Data [firstLabelKey ][0 ],
478499 secondLabelKey , topologyLabel .Data [secondLabelKey ][0 ], topologyLabel .Data [secondLabelKey ][1 ],
479- domain , rangeName , textPanel .Key , textPanel .Title , textPanel .Text ,
500+ domain , rangeName , relativeTime , textPanel .Key , textPanel .Title , textPanel .Text ,
480501 layout .LayoutStructures [0 ].Key , variable .Name , variable .DisplayName , variable .DefaultValue ,
481502 variable .SourceDefinition .(CsvVariableSourceDefinition ).Values ,
482503 )
483504}
484505
485506func dashboardUpdateConfig (title string , description string , theme string , refreshInterval int ,
486- topologyLabel string , topologyLabelValue string , domain string , rangeName string ,
507+ topologyLabel string , topologyLabelValue string , domain string , rangeName string , relativeTime string ,
487508 textPanel TextPanel , searchPanel SumoSearchPanel , layout GridLayout ,
488509 variables []Variable ) string {
489510
@@ -512,6 +533,12 @@ func dashboardUpdateConfig(title string, description string, theme string, refre
512533 range_name = "%s"
513534 }
514535 }
536+
537+ to {
538+ relative_time_range {
539+ relative_time = "%s"
540+ }
541+ }
515542 }
516543 }
517544 panel {
@@ -540,7 +567,7 @@ func dashboardUpdateConfig(title string, description string, theme string, refre
540567 begin_bounded_time_range {
541568 from {
542569 relative_time_range {
543- relative_time = "-1d "
570+ relative_time = "-60m "
544571 }
545572 }
546573 }
@@ -588,7 +615,7 @@ func dashboardUpdateConfig(title string, description string, theme string, refre
588615 }
589616 }` ,
590617 title , description , refreshInterval , theme , topologyLabel , topologyLabelValue , domain ,
591- rangeName , textPanel .Key , textPanel .Title , textPanel .Text ,
618+ rangeName , relativeTime , textPanel .Key , textPanel .Title , textPanel .Text ,
592619 searchPanel .Key , searchPanel .Title , searchPanel .Description , searchPanel .Queries [0 ].QueryString ,
593620 searchPanel .Queries [0 ].QueryKey ,
594621 layout .LayoutStructures [0 ].Key , layout .LayoutStructures [1 ].Key ,
0 commit comments