Skip to content

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

Open
@matifali

Description

@matifali
Member

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

Activity

stirby

stirby commented on Mar 6, 2025

@stirby
Contributor

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.

matifali

matifali commented on May 27, 2025

@matifali
MemberAuthor

@Emyrk, would this be handled now with dynamic parameters?

Emyrk

Emyrk commented on May 27, 2025

@Emyrk
Member

@matifali If I understand correctly, then yes.

Dynamic params will show an empty form input, and have a required mark. The user must provide a value before submitting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Emyrk@matifali@stirby

        Issue actions

          parameter validation errors should happen in the wizard instead of the workspace build · Issue #333 · coder/terraform-provider-coder