Skip to content

Commit c569c4c

Browse files
author
Pedro Montiel
committed
INVS-680: Fix hard fail on empty tag
In the Go programming language, nil is a zero value. An empty string is the zero value for strings. goroutine 113 [running]: github.com/SumoLogic/terraform-provider-sumologic/sumologic.resourceToStringArray({0x1400095de40, 0x1, 0x1}) github.com/SumoLogic/terraform-provider-sumologic/sumologic/sumologic_cse_rule_common.go:74 +0xf0 github.com/SumoLogic/terraform-provider-sumologic/sumologic.resourceSumologicCSEMatchRuleCreate(0x1400021cfc0, {0x101377f80, 0x1400012cd80}) github.com/SumoLogic/terraform-provider-sumologic/sumologic/resource_sumologic_cse_match_rule.go:114 +0x3f4 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0x140000adcc0, 0x14000150b90, 0x1400072a8e0, {0x101377f80, 0x1400012cd80}) github.com/hashicorp/[email protected]/helper/schema/resource.go:320 +0x528 github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0x1400009c200, 0x1400087ba40, 0x14000150b90, 0x1400072a8e0) github.com/hashicorp/[email protected]/helper/schema/provider.go:294 +0x88 github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0x14000584010, {0x1013a5d70, 0x1400094ab70}, 0x1400021c380) github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:895 +0x8cc github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x10134a7e0, 0x14000584010}, {0x1013a5d70, 0x1400094ab70}, 0x1400012c6c0, 0x0) github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3305 +0x1c0 google.golang.org/grpc.(*Server).processUnaryRPC(0x14000399c00, {0x1013b4368, 0x140001f8900}, 0x1400000a480, 0x1400010def0, 0x1019defa0, 0x0) google.golang.org/[email protected]/server.go:1292 +0xc04 google.golang.org/grpc.(*Server).handleStream(0x14000399c00, {0x1013b4368, 0x140001f8900}, 0x1400000a480, 0x0) google.golang.org/[email protected]/server.go:1617 +0xa34 google.golang.org/grpc.(*Server).serveStreams.func1.2(0x14000117030, 0x14000399c00, {0x1013b4368, 0x140001f8900}, 0x1400000a480) google.golang.org/[email protected]/server.go:940 +0x94 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/[email protected]/server.go:938 +0x1f0
1 parent 6103c5e commit c569c4c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## 2.19.1 (Unreleased)
22
FEATURES:
33
* Add new optional `resolution_window` field to resource/sumologic_monitor (GH-418)
4+
BUG FIXES:
5+
* cse rules hard failing if passing tags with empty strings. (GH-444)
46

57
## 2.19.0 (September 20, 2022)
68
FEATURES:

sumologic/sumologic_cse_rule_common.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ func resourceToStringArray(resourceStrings []interface{}) []string {
7171
result := make([]string, len(resourceStrings))
7272

7373
for i, resourceString := range resourceStrings {
74-
result[i] = resourceString.(string)
74+
if resourceString != nil {
75+
result[i] = resourceString.(string)
76+
}
7577
}
7678

7779
return result

0 commit comments

Comments
 (0)