Skip to content

Commit fac00c7

Browse files
committed
chore: update preset.icon to use ValidateURL
1 parent 6a4d070 commit fac00c7

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

provider/workspace_preset.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package provider
33
import (
44
"context"
55
"fmt"
6-
"net/url"
76
"strings"
87
"time"
98

@@ -106,18 +105,9 @@ func workspacePresetDataSource() *schema.Resource {
106105
Description: "A URL to an icon that will display in the dashboard. View built-in " +
107106
"icons [here](https://github.com/coder/coder/tree/main/site/static/icon). Use a " +
108107
"built-in icon with `\"${data.coder_workspace.me.access_url}/icon/<path>\"`.",
109-
ForceNew: true,
110-
Optional: true,
111-
ValidateFunc: func(value interface{}, label string) ([]string, []error) {
112-
val, ok := value.(string)
113-
if !ok {
114-
return nil, []error{fmt.Errorf("expected %q to be a string", label)}
115-
}
116-
if _, err := url.Parse(val); err != nil {
117-
return nil, []error{err}
118-
}
119-
return nil, nil
120-
},
108+
ForceNew: true,
109+
Optional: true,
110+
ValidateFunc: helpers.ValidateURL,
121111
},
122112
"default": {
123113
Type: schema.TypeBool,

0 commit comments

Comments
 (0)