Skip to content

Commit ae7e712

Browse files
author
Pedro Montiel
committed
PR comment
1 parent 055ef0f commit ae7e712

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

sumologic/resource_sumologic_cse_match_list.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,27 +227,18 @@ func resourceSumologicCSEMatchListUpdate(d *schema.ResourceData, meta interface{
227227
var items []CSEMatchListItemPost
228228
for _, data := range itemsData {
229229
item, id := resourceToCSEMatchListItem([]interface{}{data})
230+
item.ID = ""
230231
items = append(items, item)
231232
itemIds = append(itemIds, id)
232233

233234
}
234235

235236
if len(items) > 0 {
236-
for _, item := range items {
237-
CSEMatchListItem, er := c.GetCSEMatchListItem(item.ID)
238-
log.Printf("[WARN] An error occurred while getting match list item with id: %s, err: %v", item.ID, er)
239-
if CSEMatchListItem != nil {
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)
243-
}
244-
} else {
245-
err4 := c.CreateCSEMatchListItems([]CSEMatchListItemPost{item}, d.Id())
246-
if err4 != nil {
247-
log.Printf("[WARN] An error occurred while adding match list item to match list id: %s, err: %v", d.Id(), err4)
248-
}
249-
}
237+
err2 := c.CreateCSEMatchListItems(items, d.Id())
238+
if err2 != nil {
239+
log.Printf("[WARN] An error occurred while adding match list items to match list id: %s, err: %v", d.Id(), err2)
250240
}
241+
251242
}
252243

253244
var CSEMatchListItems *CSEMatchListItemsInMatchListGet

0 commit comments

Comments
 (0)