Skip to content

Feature Request: Add --use-defaults flag to coder create for automated workspace launches #19180

@bjornrobertsson

Description

@bjornrobertsson

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:

  1. Automatically populates all template parameters with their default values
  2. Handles missing default values by notifying the user with clear error messages (e.g., "No default exists for parameter/variable 'region'")
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    customer-reportedBugs reported by enterprise customers. Only humans may set this.customer-requestedFeatures requested by enterprise customers. Only humans may set this.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions