From 02b680aeae1c5ffb685f0fad00bb3f4083bd46d1 Mon Sep 17 00:00:00 2001 From: Ashwin Kachhara Date: Mon, 8 Apr 2019 15:06:28 -0700 Subject: [PATCH 1/2] trimSpaces on read --- wavefront/resource_alert.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wavefront/resource_alert.go b/wavefront/resource_alert.go index a1e3482..c08abec 100644 --- a/wavefront/resource_alert.go +++ b/wavefront/resource_alert.go @@ -121,9 +121,9 @@ func resourceAlertRead(d *schema.ResourceData, m interface{}) error { d.SetId(*tmpAlert.ID) d.Set("name", tmpAlert.Name) d.Set("target", tmpAlert.Target) - d.Set("condition", tmpAlert.Condition) - d.Set("additional_information", tmpAlert.AdditionalInfo) - d.Set("display_expression", tmpAlert.DisplayExpression) + d.Set("condition", trimSpaces(tmpAlert.Condition)) + d.Set("additional_information", trimSpaces(tmpAlert.AdditionalInfo)) + d.Set("display_expression", trimSpaces(tmpAlert.DisplayExpression)) d.Set("minutes", tmpAlert.Minutes) d.Set("resolve_after_minutes", tmpAlert.ResolveAfterMinutes) d.Set("notification_resend_frequency_minutes", tmpAlert.NotificationResendFrequencyMinutes) From 490339b61f6561bddbe5b62440c3d5f761a5dcd1 Mon Sep 17 00:00:00 2001 From: Ashwin Kachhara Date: Mon, 15 Apr 2019 11:44:36 -0700 Subject: [PATCH 2/2] fix others --- wavefront/resource_alert.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wavefront/resource_alert.go b/wavefront/resource_alert.go index c08abec..d28c6d4 100644 --- a/wavefront/resource_alert.go +++ b/wavefront/resource_alert.go @@ -82,9 +82,9 @@ func resourceAlertCreate(d *schema.ResourceData, m interface{}) error { a := &wavefront.Alert{ Name: d.Get("name").(string), Target: d.Get("target").(string), - Condition: d.Get("condition").(string), - AdditionalInfo: d.Get("additional_information").(string), - DisplayExpression: d.Get("display_expression").(string), + Condition: trimSpaces(d.Get("condition").(string)), + AdditionalInfo: trimSpaces(d.Get("additional_information").(string)), + DisplayExpression: trimSpaces(d.Get("display_expression").(string)), Minutes: d.Get("minutes").(int), ResolveAfterMinutes: d.Get("resolve_after_minutes").(int), NotificationResendFrequencyMinutes: d.Get("notification_resend_frequency_minutes").(int), @@ -152,9 +152,9 @@ func resourceAlertUpdate(d *schema.ResourceData, m interface{}) error { a := tmpAlert a.Name = d.Get("name").(string) a.Target = d.Get("target").(string) - a.Condition = d.Get("condition").(string) - a.AdditionalInfo = d.Get("additional_information").(string) - a.DisplayExpression = d.Get("display_expression").(string) + a.Condition = trimSpaces(d.Get("condition").(string)) + a.AdditionalInfo = trimSpaces(d.Get("additional_information").(string)) + a.DisplayExpression = trimSpaces(d.Get("display_expression").(string)) a.Minutes = d.Get("minutes").(int) a.ResolveAfterMinutes = d.Get("resolve_after_minutes").(int) a.NotificationResendFrequencyMinutes = d.Get("notification_resend_frequency_minutes").(int)