diff --git a/internal/provider/provider.go b/internal/provider/provider.go index a5608754..5d3a5a16 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -406,6 +406,21 @@ func New() *schema.Provider { ForceNew: true, Optional: true, }, + "icon": { + Type: schema.TypeString, + Description: "A URL to an icon that will display in the dashboard. View built-in " + + "icons here: https://github.com/coder/coder/tree/main/site/static/icon. Use a " + + "built-in icon with `data.coder_workspace.me.access_url + \"/icons/\"`.", + ForceNew: true, + Optional: true, + ValidateFunc: func(i interface{}, s string) ([]string, []error) { + _, err := url.Parse(s) + if err != nil { + return nil, []error{err} + } + return nil, nil + }, + }, "item": { Type: schema.TypeList, Description: "Each \"item\" block defines a single metadata item consisting of a key/value pair.", diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index d2bb2362..07cd7eba 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -264,6 +264,7 @@ func TestMetadata(t *testing.T) { resource "coder_metadata" "agent" { resource_id = coder_agent.dev.id hide = true + icon = "/icons/storage.svg" item { key = "foo" value = "bar" @@ -297,6 +298,7 @@ func TestMetadata(t *testing.T) { for key, expected := range map[string]string{ "resource_id": agent.Primary.Attributes["id"], "hide": "true", + "icon": "/icons/storage.svg", "item.#": "5", "item.0.key": "foo", "item.0.value": "bar",