Closed
Description
coder create
checks for the name after running the terraform plan
, which is fine in most cases even though it makes you lose some time.
Here is what would usually happen to an user :
output of coder create phorcys420/invalid_name -t aws-linux
(on dogfood)
PS C:\Users\Phorcys\Documents> coder create phorcys420/invalid_name -t aws-linux
AWS Region
The region to deploy workspace infrastructure.
? EU (Paris)
> EU (Paris)
Instance type
What instance type should your workspace use?
? 2 vCPU, 1 GiB RAM
> 2 vCPU, 1 GiB RAM
Planning workspace...
=== ✔ Queued [0ms]
==> ⧗ Running
==> ⧗ Running
=== ✔ Running [13ms]
==> ⧗ Setting up
=== ✔ Setting up [69ms]
==> ⧗ Detecting persistent resources
=== ✔ Detecting persistent resources [15661ms]
==> ⧗ Cleaning Up
=== ✔ Cleaning Up [39ms]
┌──────────────────────────────────────────────────────────┐
│ Workspace Preview │
├──────────────────────────────────────────────────────────┤
│ RESOURCE ACCESS │
├──────────────────────────────────────────────────────────┤
│ aws_ec2_instance_state.dev │
├──────────────────────────────────────────────────────────┤
│ aws_instance.dev │
│ └─ dev (linux, amd64) coder ssh invalid_name │
└──────────────────────────────────────────────────────────┘
> Confirm create? (yes/no) yes
Encountered an error running "coder create", see "coder create --help" for more information
error: Trace=[create workspace: ]
Validation failed.
1 validation error(s) found
name : Validation failed for tag "workspace_name" with value: "invalid_name"
But in some cases, it will even make the plan fail if the workspace name causes an error in the template, such as with _
in k8s.
Which makes it so that it doesn't even show the validation error because the plan exits before the validation.
output of coder create
commands with the sample Kubernetes template (on my testing instance)
PS C:\Users\Phorcys> coder create admin/workshop_ia -t kubernetes-titimoby
version mismatch: client v2.11.2+d53c94b, server v2.10.2+a11b169
download the server version from: https://github.com/coder/coder/releases/v2.10.2
Planning workspace...
=== ✔ Queued [70ms]
==> ⧗ Running
==> ⧗ Running
=== ✔ Running [36ms]
==> ⧗ Setting up
=== ✔ Setting up [114ms]
==> ⧗ Detecting persistent resources
=== ✔ Detecting persistent resources [6134ms]
==> ⧗ Cleaning Up
=== ✘ Cleaning Up [12ms]
=== ✘ Cleaning Up [31ms]
Encountered an error running "coder create", see "coder create --help" for more information
error: prepare build: dry-run workspace: run dry-run provision job: terraform plan: exit status 1
PS C:\Users\Phorcys> coder create admin/workshop-ia -t kubernetes-titimoby
version mismatch: client v2.11.2+d53c94b, server v2.10.2+a11b169
download the server version from: https://github.com/coder/coder/releases/v2.10.2
Planning workspace...
=== ✔ Queued [64ms]
==> ⧗ Running
==> ⧗ Running
=== ✔ Running [12ms]
==> ⧗ Setting up
=== ✔ Setting up [106ms]
==> ⧗ Detecting persistent resources
=== ✔ Detecting persistent resources [7152ms]
==> ⧗ Cleaning Up
=== ✔ Cleaning Up [93ms]
┌──────────────────────────────────────────────────────────────────────┐
│ Workspace Preview │
├──────────────────────────────────────────────────────────────────────┤
│ RESOURCE ACCESS │
├──────────────────────────────────────────────────────────────────────┤
│ kubernetes_deployment.main │
│ └─ main (linux, amd64) coder ssh workshop-ia │
├──────────────────────────────────────────────────────────────────────┤
│ kubernetes_persistent_volume_claim.home │
└──────────────────────────────────────────────────────────────────────┘
This should be a relatively low-effort change in my opinion.
Metadata
Metadata
Assignees
Labels
No labels