@@ -237,16 +237,9 @@ func resourceSumologicCSEMatchListUpdate(d *schema.ResourceData, meta interface{
237237 CSEMatchListItem , er := c .GetCSEMatchListItem (item .ID )
238238 log .Printf ("[WARN] An error occurred while getting match list item with id: %s, err: %v" , item .ID , er )
239239 if CSEMatchListItem != nil {
240- if contains (itemIds , CSEMatchListItem .ID ) {
241- err3 := c .UpdateCSEMatchListItem (item )
242- if err3 != nil {
243- log .Printf ("[WARN] An error occurred while updating match list item with id: %s, err: %v" , item .ID , err3 )
244- }
245- } else {
246- err3 := c .DeleteCSEMatchListItem (CSEMatchListItem .ID )
247- if err3 != nil {
248- log .Printf ("[WARN] An error occurred deleting match list item with id: %s, err: %v" , CSEMatchListItem .ID , err3 )
249- }
240+ err3 := c .UpdateCSEMatchListItem (item )
241+ if err3 != nil {
242+ log .Printf ("[WARN] An error occurred while updating match list item with id: %s, err: %v" , item .ID , err3 )
250243 }
251244 } else {
252245 err4 := c .CreateCSEMatchListItems (items , d .Id ())
@@ -255,16 +248,18 @@ func resourceSumologicCSEMatchListUpdate(d *schema.ResourceData, meta interface{
255248 }
256249 }
257250 }
258- } else {
259- var CSEMatchListItems * CSEMatchListItemsInMatchListGet
251+ }
260252
261- CSEMatchListItems , err2 := c .GetCSEMatchListItemsInMatchList (d .Id ())
262- if err2 != nil {
263- log .Printf ("[WARN] CSE Match List items not found when looking by match list id: %s, err: %v" , d .Id (), err2 )
264- }
265- if CSEMatchListItems != nil {
253+ var CSEMatchListItems * CSEMatchListItemsInMatchListGet
254+
255+ CSEMatchListItems , err2 := c .GetCSEMatchListItemsInMatchList (d .Id ())
256+ if err2 != nil {
257+ log .Printf ("[WARN] CSE Match List items not found when looking by match list id: %s, err: %v" , d .Id (), err2 )
258+ }
259+ if CSEMatchListItems != nil {
266260
267- for _ , t := range CSEMatchListItems .CSEMatchListItemsGetObjects {
261+ for _ , t := range CSEMatchListItems .CSEMatchListItemsGetObjects {
262+ if ! contains (itemIds , t .ID ) {
268263 err3 := c .DeleteCSEMatchListItem (t .ID )
269264 if err3 != nil {
270265 log .Printf ("[WARN] An error occurred deleting match list item with id: %s, err: %v" , t .ID , err3 )
0 commit comments