Skip to content

Commit b9c0a43

Browse files
committed
changelog and nits
1 parent b092262 commit b9c0a43

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ ENHANCEMENTS:
55

66
BUG FIXES:
77
* Fix error while importing monitor having timeZone as `null` in the Email notification object. (GH-637)
8-
* Fix perpetual diff in Extraction Rules by normalizing the parse expression.
8+
* Fix perpetual diff in Extraction Rules by normalizing the parse expression.
9+
* Fix `resource_sumologic_cse_match_list` timing out when updating match list items
910

1011
## 2.28.3 (March 5, 2024)
1112

sumologic/resource_sumologic_cse_match_list.go

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package sumologic
33
import (
44
"fmt"
55
"log"
6-
"os"
76
"regexp"
87
"time"
98

@@ -190,8 +189,6 @@ func resourceSumologicCSEMatchListCreate(d *schema.ResourceData, meta interface{
190189
}
191190
}
192191

193-
fmt.Fprintln(os.Stdout, "resourceSumologicCSEMatchListCreate items: ", items)
194-
195192
createStateConf := &resource.StateChangeConf{
196193
Target: []string{
197194
fmt.Sprint(len(items)),
@@ -284,8 +281,6 @@ func resourceSumologicCSEMatchListUpdate(d *schema.ResourceData, meta interface{
284281
}
285282
}
286283

287-
fmt.Fprintln(os.Stdout, "resourceSumologicCSEMatchListUpdate deleteItemIds: ", deleteItemIds, "updateItems: ", updateItems, "addItems: s", addItems)
288-
289284
// Delete old items
290285
for _, oldItem := range CSEMatchListItems.CSEMatchListItemsGetObjects {
291286
if contains(deleteItemIds, oldItem.ID) {
@@ -312,13 +307,8 @@ func resourceSumologicCSEMatchListUpdate(d *schema.ResourceData, meta interface{
312307
}
313308
}
314309

315-
CSEMatchListItems, err = c.GetCSEMatchListItemsInMatchList(d.Id())
316-
if err != nil {
317-
return fmt.Errorf("[ERROR] CSE Match List items not found when looking by match list id %s, err: %v", d.Id(), err)
318-
}
319-
320310
// Wait for update to finish
321-
createStateConf := &resource.StateChangeConf{
311+
updateStateConf := &resource.StateChangeConf{
322312
Target: []string{
323313
fmt.Sprint(len(newItems)),
324314
},
@@ -336,7 +326,7 @@ func resourceSumologicCSEMatchListUpdate(d *schema.ResourceData, meta interface{
336326
ContinuousTargetOccurence: 1,
337327
}
338328

339-
_, err = createStateConf.WaitForState()
329+
_, err = updateStateConf.WaitForState()
340330
if err != nil {
341331
return fmt.Errorf("[ERROR] Error waiting for match list with id %s to be updated: %s", d.Id(), err)
342332
}

sumologic/resource_sumologic_cse_match_list_test.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package sumologic
22

33
import (
44
"fmt"
5-
"os"
65
"strings"
76
"testing"
87

@@ -25,7 +24,7 @@ func TestAccSumologicSCEMatchList_createAndUpdate(t *testing.T) {
2524
liDescription := "Match List Item Description"
2625
liExpiration := "2122-02-27T04:00:00"
2726
liValue := "value"
28-
liCount := 1
27+
liCount := 2
2928

3029
// Update values
3130
uDefaultTtl := 3600
@@ -40,7 +39,7 @@ func TestAccSumologicSCEMatchList_createAndUpdate(t *testing.T) {
4039
Providers: testAccProviders,
4140
CheckDestroy: testAccCSEMatchListDestroy,
4241
Steps: []resource.TestStep{
43-
// Creates a match list with 1 match list item
42+
// Creates a match list with 2 match list items
4443
{
4544
Config: testCreateCSEMatchListConfig(nDefaultTtl, nDescription, nName, nTargetColumn, liDescription, liExpiration, liValue, liCount),
4645
Check: resource.ComposeTestCheckFunc(
@@ -50,7 +49,7 @@ func TestAccSumologicSCEMatchList_createAndUpdate(t *testing.T) {
5049
resource.TestCheckResourceAttrSet(resourceName, "id"),
5150
),
5251
},
53-
// Updates the match list and its 1 match list item
52+
// Updates the match list and its 2 match list items
5453
{
5554
Config: testCreateCSEMatchListConfig(uDefaultTtl, uDescription, nName, nTargetColumn, liDescription, liExpiration, liValue, liCount),
5655
Check: resource.ComposeTestCheckFunc(
@@ -60,7 +59,7 @@ func TestAccSumologicSCEMatchList_createAndUpdate(t *testing.T) {
6059
resource.TestCheckResourceAttrSet(resourceName, "id"),
6160
),
6261
},
63-
// Deletes the 1 match list item and adds 3 new ones
62+
// Deletes the 2 old match list items and adds 3 new ones
6463
{
6564
Config: testCreateCSEMatchListConfig(uDefaultTtl, uDescription, nName, nTargetColumn, uliDescription, uliExpiration, uliValue, uliCount),
6665
Check: resource.ComposeTestCheckFunc(
@@ -123,8 +122,6 @@ resource "sumologic_cse_match_list" "match_list" {
123122
target_column = "%s" %s
124123
}`, nDefaultTtl, nDescription, nName, nTargetColumn, itemsStr)
125124

126-
fmt.Fprintln(os.Stdout, "testCreateCSEMatchListConfig: ", str)
127-
128125
return str
129126
}
130127

0 commit comments

Comments
 (0)