diff --git a/src/terraform-provider-paperspace/client.go b/src/terraform-provider-paperspace/client.go index eaaebdf..8a1fb09 100644 --- a/src/terraform-provider-paperspace/client.go +++ b/src/terraform-provider-paperspace/client.go @@ -8,6 +8,7 @@ import ( "net/http" "net/url" "reflect" + "strconv" "strings" "time" @@ -316,7 +317,7 @@ func (paperspaceClient *PaperspaceClient) GetTeamNamedNetwork(teamID int, name s } } - return nil, fmt.Errorf("Error getting private network: %s", name) + return nil, fmt.Errorf("Error getting private network by name: %s", name) } func (paperspaceClient *PaperspaceClient) GetTeamNamedNetworkById(teamID int, id string) (*NamedNetwork, error) { @@ -326,10 +327,10 @@ func (paperspaceClient *PaperspaceClient) GetTeamNamedNetworkById(teamID int, id } for _, namedNetwork := range namedNetworks { - if string(namedNetwork.Network.ID) == id { + if strconv.Itoa(namedNetwork.Network.ID) == id { return &namedNetwork, nil } } - return nil, fmt.Errorf("Error getting private network: %s", id) + return nil, fmt.Errorf("Error getting private network by id: %s", id) } diff --git a/src/terraform-provider-paperspace/resource_network.go b/src/terraform-provider-paperspace/resource_network.go index d417e70..3a13323 100644 --- a/src/terraform-provider-paperspace/resource_network.go +++ b/src/terraform-provider-paperspace/resource_network.go @@ -3,6 +3,7 @@ package main import ( "fmt" "math/rand" + "strconv" "time" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" @@ -68,7 +69,7 @@ func resourceNetworkCreate(d *schema.ResourceData, m interface{}) error { return resource.RetryableError(fmt.Errorf("Error creating private network: %s", err)) } - d.SetId(string(namedNetwork.Network.ID)) + d.SetId(strconv.Itoa(namedNetwork.Network.ID)) return resource.NonRetryableError(resourceNetworkRead(d, m)) }) } @@ -86,7 +87,7 @@ func resourceNetworkRead(d *schema.ResourceData, m interface{}) error { return err } - d.SetId(string(namedNetwork.Network.ID)) + d.SetId(strconv.Itoa(namedNetwork.Network.ID)) updateNetworkSchema(d, namedNetwork.Network, namedNetwork.Name) return nil