diff --git a/signalfx/resource_signalfx_metric_ruleset.go b/signalfx/resource_signalfx_metric_ruleset.go index 220ec5dc..ce52ecba 100644 --- a/signalfx/resource_signalfx_metric_ruleset.go +++ b/signalfx/resource_signalfx_metric_ruleset.go @@ -617,9 +617,9 @@ func getRestoration(tfRule map[string]interface{}) metric_ruleset.ExceptionRuleR panic(err) } - stopTime, err := strconv.ParseInt(restoration["stop_time"].(string), 10, 64) - if err != nil { - panic(err) + stopTime, err1 := strconv.ParseInt(restoration["stop_time"].(string), 10, 64) + if err1 != nil { + panic(err1) } restorationFields := &metric_ruleset.ExceptionRuleRestorationFields{ diff --git a/signalfx/resource_signalfx_metric_ruleset_test.go b/signalfx/resource_signalfx_metric_ruleset_test.go index 4baa8379..d6202eed 100644 --- a/signalfx/resource_signalfx_metric_ruleset_test.go +++ b/signalfx/resource_signalfx_metric_ruleset_test.go @@ -469,6 +469,7 @@ func TestAccMetricRulesetArchived(t *testing.T) { func TestAccMetricRulesetRestoration(t *testing.T) { // 15 minutes ago in milliseconds startTime := (time.Now().Unix() - 900) * 1000 + stopTime := (time.Now().Unix() - 200) * 1000 archivedCartSizeRestore := fmt.Sprintf(` resource "signalfx_metric_ruleset" "cart_size" { @@ -487,13 +488,14 @@ resource "signalfx_metric_ruleset" "cart_size" { } restoration { start_time = %d + stop_time = %d } } routing_rule { destination = "Archived" } -} `, startTime) +} `, startTime, stopTime) archivedCartSizeRestoreUpdate := fmt.Sprintf(` resource "signalfx_metric_ruleset" "cart_size" { @@ -512,13 +514,14 @@ resource "signalfx_metric_ruleset" "cart_size" { } restoration { start_time = %d + stop_time = %d } } routing_rule { destination = "Archived" } -} `, startTime) +} `, startTime, stopTime) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -550,6 +553,7 @@ resource "signalfx_metric_ruleset" "cart_size" { resource.TestCheckResourceAttr("signalfx_metric_ruleset.cart_size", "exception_rules.0.matcher.0.filters.0.not", "false"), resource.TestCheckResourceAttr("signalfx_metric_ruleset.cart_size", "exception_rules.0.restoration.0.start_time", strconv.FormatInt(startTime, 10)), + resource.TestCheckResourceAttr("signalfx_metric_ruleset.cart_size", "exception_rules.0.restoration.0.stop_time", strconv.FormatInt(stopTime, 10)), ), }, // Validate plan @@ -578,6 +582,7 @@ resource "signalfx_metric_ruleset" "cart_size" { resource.TestCheckResourceAttr("signalfx_metric_ruleset.cart_size", "exception_rules.0.matcher.0.filters.0.not", "false"), resource.TestCheckResourceAttr("signalfx_metric_ruleset.cart_size", "exception_rules.0.restoration.0.start_time", strconv.FormatInt(startTime, 10)), + resource.TestCheckResourceAttr("signalfx_metric_ruleset.cart_size", "exception_rules.0.restoration.0.stop_time", strconv.FormatInt(stopTime, 10)), ), }, },