-
Notifications
You must be signed in to change notification settings - Fork 956
Description
Problem Description
The current behaviour of coder create
makes fully automated workspace launches difficult because it prompts for parameter selection even when using the --yes
flag.
For example, an AZ or Region selection with a Default value would be perfectly acceptable, and CI/CD pipeline would be improved if it doesn't need (regularly) updated defaults or --env fixes if the Templates change.
Expected Behaviour
The CLI should provide behaviour consistent with the Coder UI, where submitting the workspace launch form with default values is possible without user interaction - either variables or parameters should be taken as default.
Proposed Solution
Add a new CLI flag (e.g., --use-defaults
) to the coder create
command that:
- Automatically populates all template parameters with their default values
- Handles missing default values by notifying the user with clear error messages (e.g., "No default exists for parameter/variable 'region'")
- Behaves similarly to
DEBIAN_FRONTEND=noninteractive
where no questions are asked
Considerations
- Validation: Not all template parameters have default values, so the system should check for missing defaults and fail gracefully (close to the current behaviour)
- Notice of precedence: Consider how this interacts with Terraform variable handling and existing parameter files ("current" default values may sometimes not align with Template values, output is needed to print or confirm what actual value was used)
- Error handling: Clear messaging when required parameters lack default values (i.e. No default exists for ...)
- UI consistency: Consider adding a "Use Defaults" button to the UI for similar functionality
Alternative Approaches Considered
- Overloading the existing
--yes
flag would be possible, but the--yes
and UI behaviour would not necessarily align and the typical setup in software uses 'ignore' or 'force' also to bypass questions.
Use Case
This feature would significantly improve automation workflows where workspaces need to be created programmatically without user intervention, while still maintaining safety by requiring explicit defaults to be set in templates.