Skip to content

Commit

Permalink
fix: readfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tenstad committed Apr 14, 2024
1 parent 4d420f5 commit 82e43c0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/provider/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package provider
import (
"context"
"fmt"
"io/ioutil"
"net"
"os"
"time"
Expand Down Expand Up @@ -76,8 +75,7 @@ var connectionSchemaResource = &schema.Resource{
}

func ConnectionFromResourceData(ctx context.Context, d *schema.ResourceData) (string, *ssh.ClientConfig, error) {
_, ok := d.GetOk("conn")
if !ok {
if _, ok := d.GetOk("conn"); !ok {
return "", nil, fmt.Errorf("resouce does not have a connection configured")
}

Expand All @@ -102,7 +100,7 @@ func ConnectionFromResourceData(ctx context.Context, d *schema.ResourceData) (st

private_key_path, ok := d.GetOk("conn.0.private_key_path")
if ok {
content, err := ioutil.ReadFile(private_key_path.(string))
content, err := os.ReadFile(private_key_path.(string))
if err != nil {
return "", nil, fmt.Errorf("couldn't read private key: %s", err.Error())
}
Expand Down

0 comments on commit 82e43c0

Please sign in to comment.