Skip to content

Commit 96b20b5

Browse files
authored
Fix multiple resources logs (#445)
1 parent cecfeb2 commit 96b20b5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
1111
github.com/alessio/shellescape v1.4.1 // indirect
1212
github.com/aohorodnyk/uid v1.1.0
13-
github.com/aws/aws-sdk-go v1.40.27
13+
github.com/aws/aws-sdk-go v1.40.27 // indirect
1414
github.com/aws/aws-sdk-go-v2 v1.11.0
1515
github.com/aws/aws-sdk-go-v2/config v1.8.3
1616
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.14.0

iterative/utils/logger.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package utils
22

33
import (
4+
"errors"
45
"fmt"
5-
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
6-
"github.com/sirupsen/logrus"
76
"strings"
87
"time"
8+
9+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
10+
"github.com/sirupsen/logrus"
911
)
1012

1113
var baseTimestamp = time.Now()
@@ -40,6 +42,10 @@ func (f *tpiFormatter) Format(entry *logrus.Entry) ([]byte, error) {
4042
data[k] = v
4143
}
4244

45+
if data["d"] == nil {
46+
return nil, errors.New("ResourceData is not available")
47+
}
48+
4349
d := data["d"].(*schema.ResourceData)
4450
message := entry.Message
4551
levelText := strings.ToUpper(entry.Level.String())

0 commit comments

Comments
 (0)