Skip to content

feat: mark coder_parameter as "required" #6433

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Mar 7, 2023

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Mar 3, 2023

Related: #6100

This PR extends the rich parameters feature to let users mark them as optional. This behavior is consistent with Terraform variables.

A rich parameter is considered required when it doesn't contain the default property, so:

data "coder_parameter" "another_required_field" {
  name        = "Another required field"
  icon        = "/icon/aws.png"
  description = "This string is required"
  mutable     = true
}

If we want to mark the parameter as optional, we need to add the default property:

data "coder_parameter" "random_string" {
  name         = "Optional random string"
  icon         = "/icon/aws.png"
  description  = "This string is optional"
  mutable      = true
  default      = ""
}

Changes:

  • use the latest terraform-provider-coder to support computed property "optional" (not exposed to users)
  • adjust coderd API to expose required property
  • site: allow for empty, optional parameters
  • site: use HTML API to check if field is required
  • modify CLI to allow for entering values for newly added parameters to templates

Follow-ups:

  • present a special form or popup to enter required params without defaults (especially if those are new parameters)

@mtojek mtojek self-assigned this Mar 3, 2023
@mtojek mtojek changed the title Add required column feat: mark coder_parameter as "required" Mar 3, 2023
@mtojek mtojek marked this pull request as ready for review March 7, 2023 11:23
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

@mtojek mtojek merged commit 2d4706a into coder:main Mar 7, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants