Add `map(string)` to `code_parameter` support type

I'm using the vscode-web module in the template. When my team creates workspaces from the template, I want to allow them to select extensions and apply settings that suit their needs by using the coder_parameter vscode_web_extensions and vscode_settings. In main.tf:
data "coder_parameter" "vscode_web_extensions" {
description = <<-EOF
A list of extensions to install to VS Code web.
EOF
display_name = "VS Code Web Extensions"
mutable = true
name = "vscode_web_extensions"
type = "list(string)"

}

data "coder_parameter" "vscode_settings" {
description = <<-EOF
A map of settings to apply to VS Code web.
EOF
display_name = "VS Code Web Settings"
mutable = true
name = "vscode_settings"
type = "map(string)"
}

module "vscode-web" {
source = "registry.coder.com/modules/vscode-web/coder"
version = "1.0.22"
agent_id = coder_agent.main.id
extensions = data.coder_parameter.vscode_web_extensions.value
accept_license = true
settings = data.coder_parameter.vscode_settings.value

folder = "/workspaces"
subdomain = false
}
data "coder_parameter" "vscode_web_extensions" {
description = <<-EOF
A list of extensions to install to VS Code web.
EOF
display_name = "VS Code Web Extensions"
mutable = true
name = "vscode_web_extensions"
type = "list(string)"

}

data "coder_parameter" "vscode_settings" {
description = <<-EOF
A map of settings to apply to VS Code web.
EOF
display_name = "VS Code Web Settings"
mutable = true
name = "vscode_settings"
type = "map(string)"
}

module "vscode-web" {
source = "registry.coder.com/modules/vscode-web/coder"
version = "1.0.22"
agent_id = coder_agent.main.id
extensions = data.coder_parameter.vscode_web_extensions.value
accept_license = true
settings = data.coder_parameter.vscode_settings.value

folder = "/workspaces"
subdomain = false
}
However, currently, coder_parameter doesn't support the map type, so I don't have a way to implement this for vscode_settings. https://github.com/coder/terraform-provider-coder/blob/c9dbd6f7639765999b3e84c2f966b3a171d31a4d/provider/parameter.go#L202-L208 Will coder_parameter support type map in the near future?
GitHub
terraform-provider-coder/provider/parameter.go at c9dbd6f7639765999...
Contribute to coder/terraform-provider-coder development by creating an account on GitHub.
8 Replies
Codercord
Codercord3w ago
<#1314451610713329706>
Category
Feature request
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys3w ago
hello @Luna Lovegood are you talking about a mutli select field or a multi-input field?
Luna Lovegood
Luna LovegoodOP3w ago
Multi-input field as I described on terraform code above
Phorcys
Phorcys3w ago
wait, i'm confused oh i see as a workaround you can currently let them input JSON and parse that JSON on the terraform side afterwards i'm not sure how it'd look in the UI but please submit a feature request! https://github.com/coder/coder/issues
Luna Lovegood
Luna LovegoodOP3w ago
I'm happy to open a pull request but sadly I'm not familiar with Go language
Phorcys
Phorcys3w ago
just open an issue for now, i think even if you want to contribute it we should discuss the implementation first!
Luna Lovegood
Luna LovegoodOP3w ago
okay
Phorcys
Phorcys3w ago
thanks!

Did you find this page helpful?