From 751e52e4846cb8f058ad2d7873329c86853ecf45 Mon Sep 17 00:00:00 2001 From: corentin Date: Fri, 21 Jun 2024 18:28:07 +0200 Subject: [PATCH] [SYNTH-14611] Fix `renotify_interval` drift when saving from UI --- datadog/resource_datadog_synthetics_test_.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/datadog/resource_datadog_synthetics_test_.go b/datadog/resource_datadog_synthetics_test_.go index 544fe5816d..521500c3ca 100644 --- a/datadog/resource_datadog_synthetics_test_.go +++ b/datadog/resource_datadog_synthetics_test_.go @@ -2936,11 +2936,17 @@ func buildLocalOptions(actualOptions datadogV1.SyntheticsTestOptions) []map[stri } if actualOptions.HasMonitorOptions() { actualMonitorOptions := actualOptions.GetMonitorOptions() - renotifyInterval := actualMonitorOptions.GetRenotifyInterval() - optionsListMonitorOptions := make(map[string]int64) - optionsListMonitorOptions["renotify_interval"] = renotifyInterval - localOptionsList["monitor_options"] = []map[string]int64{optionsListMonitorOptions} + shouldUpdate := false + + if actualMonitorOptions.HasRenotifyInterval() { + optionsListMonitorOptions["renotify_interval"] = actualMonitorOptions.GetRenotifyInterval() + shouldUpdate = true + } + + if shouldUpdate { + localOptionsList["monitor_options"] = []map[string]int64{optionsListMonitorOptions} + } } if actualOptions.HasNoScreenshot() { localOptionsList["no_screenshot"] = actualOptions.GetNoScreenshot()