Skip to content

Commit 9167ac8

Browse files
committed
use io.ReadAll
1 parent 778d970 commit 9167ac8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

internal/services/mongodb/instance.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package mongodb
22

33
import (
4-
"bytes"
54
"context"
65
"errors"
76
"fmt"
@@ -472,12 +471,10 @@ func ResourceInstanceRead(ctx context.Context, d *schema.ResourceData, m any) di
472471
InstanceID: ID,
473472
}, scw.WithContext(ctx))
474473

475-
var buf bytes.Buffer
476-
477474
if err == nil && cert != nil {
478-
_, copyErr := io.Copy(&buf, cert.Content)
479-
if copyErr == nil {
480-
_ = d.Set("tls_certificate", buf.String())
475+
certBytes, readErr := io.ReadAll(cert.Content)
476+
if readErr == nil {
477+
_ = d.Set("tls_certificate", string(certBytes))
481478
}
482479
}
483480

0 commit comments

Comments
 (0)