Skip to content

parameter validation errors should happen in the wizard instead of the workspace build #333

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
matifali opened this issue Jan 29, 2025 · 1 comment

Comments

@matifali
Copy link
Member

matifali commented Jan 29, 2025

Given a parameter with a choice, when creating a Workspace, if the user deletes the default value in the field, in this example from "0" to ""

data "coder_parameter" "home_data_disk_size" {
  type        = "number"
  name        = "Additional Home Data Volume Size"
  mutable     = true
  default     = 0
  validation {
    min       = 0
    max       = 2048
    monotonic = "increasing"
  }
}

You get this error when the Terraform runs:

Error: value "" is not a number
on .terraform/modules/platform_eng/data.tf line 487, in data "coder_parameter" "home_data_disk_size":
  487: data "coder_parameter" "home_data_disk_size" {

I believe this should be validated when in the wizard instead. Either that or provide something like a boolean attribute in the coder_parameter schema for an option like non_empty

@stirby
Copy link
Contributor

stirby commented Mar 6, 2025

This is an excellent use case for our coder preview engine. We have a lot of areas to cover with error handling but we want to expose these earlier. Both in the workspace creation screen and when testing templates locally.

This becomes a larger headache as we allow parameter conditionality.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants