Skip to content

Commit 1fd51d0

Browse files
author
Pedro Montiel
committed
INVS-11: PR comments
1 parent 4f6bd61 commit 1fd51d0

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
## 2.14.0 (Unreleased)
2+
* **New Resource:** sumologic_cse_match_list (GH-353)
23

34
## 2.13.0 (February 24, 2022)
45

56
FEATURES:
67
* **New Resource:** sumologic_content_permission (GH-340)
7-
* **New Resource:** sumologic_cse_match_list (GH-353)
8-
9-
108

119
ENHANCEMENTS:
1210
* Add support for importing folder resource (GH-345)

sumologic/resource_sumologic_cse_match_list.go

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)