Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug: workspace template variable default value is not used if no value provided and workspace creation fails #1499

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

Closed
kconley-sq opened this issue May 17, 2022 · 1 comment · Fixed by #1584
Assignees
Labels
api Area: HTTP API
Milestone

Comments

@kconley-sq
Copy link
Contributor

OS Information

  • OS: macOS 12.3.1
  • Browser (if applicable): N/A
  • Architecture: arm64
  • coder --version:
Coder v0.5.6+bbb8f83 Thu May 12 17:59:34 UTC 2022
https://github.com/coder/coder/commit/bbb8f836bf5514c9ab67128661ed4909e98a918c

(same Coder version both on CLI and server, but server is Ubuntu 20.04 LTS x86_64)

Steps to Reproduce

  1. Create a workspace template using the aws-linux example
  2. Create a workspace from the Coder CLI using coder create --template="aws-linux" test-defaults
  3. When prompted for var.disk_size, press return without typing any other input
  4. Provide values for the other input variables and confirm the workspace creation when prompted

Expected

The workspace creation should succeed, using the default value for var.disk_size since none was provided when prompted.

Actual

The workspace creation fails with an error describing that the value provided for disk_size is invalid because a number is required. At that point, the workspace is actually in an invalid state such that you are not able to delete it nor create a new workspace with the same name (see #831 (comment)).

Logs

# coder create --template="aws-linux" test-defaults
                                                            
  This template has customizable parameters. Values can be  
  changed after create, but may have unintended side effects
  (like data loss).                                         

var.disk_size
  Specify your disk size (GiB)

> Enter a value: 
var.region
  What region should your workspace live in?

  >  us-west-2 

┌────────────────────────────────────────────────────────────────────────────────┐
│ Workspace Preview                                                              │
├────────────────────────────────────────────────────────────────────────────────┤
│ RESOURCE                             STATUS      ACCESS                        │
├────────────────────────────────────────────────────────────────────────────────┤
│ aws_instance.dev                     ephemeral                                 │
│ └─ dev (linux, amd64)                             coder ssh test-defaults.dev  │
└────────────────────────────────────────────────────────────────────────────────┘
> Confirm create? (yes/no) yes
✔ Queued [433ms]
✔ Setting up [10ms]
⧗  Starting workspace 
  Terraform 1.1.7
  Warning: Argument is deprecated
  Warning: Argument is deprecated
  Error: Invalid value for input variable
  The argument -var="disk_size=..." does not contain a valid value for variable "disk_size": a number is required.
  Error: Invalid operand
  Unsuitable value for left operand: a number is required.
  Error: Invalid operand
  Unsuitable value for left operand: a number is required.
✘ Starting workspace [6115ms]
exit status 1
@deansheather
Copy link
Member

#1584 makes Coder use the default variable values if available. We are tracking the broken builds caused by bad params result in undeletable workspaces in #831

@misskniss misskniss added this to the Community MVP milestone Jun 3, 2022
@misskniss misskniss added the api Area: HTTP API label Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Area: HTTP API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants