Skip to content

Commit a532545

Browse files
authored
Merge pull request #638 from SumoLogic/SUMO-237992
SUMO-237992: Fix perpetual diff in Extraction Rules by normalizing the parse expression
2 parents 8bb1b0d + c13895f commit a532545

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ 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.
89

910
## 2.28.3 (March 5, 2024)
1011

sumologic/resource_sumologic_extraction_rule.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ func resourceSumologicFieldExtractionRule() *schema.Resource {
4141
Type: schema.TypeString,
4242
Required: true,
4343
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
44-
if strings.Trim(old, "\n ") == strings.Trim(new, "\n ") {
45-
return true
44+
// Ignores leading spaces, leading newlines and single leading |
45+
// Ignores trailing spaces and trailing newlines.
46+
normalize := func(s string) string {
47+
return strings.TrimSpace(strings.TrimPrefix(strings.Trim(s, "\n "), "|"))
4648
}
47-
return false
49+
return normalize(old) == normalize(new)
4850
},
4951
},
5052
"enabled": {

0 commit comments

Comments
 (0)