Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/<path>\"`.",
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.",
Expand Down
2 changes: 2 additions & 0 deletions internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down