nebari icon indicating copy to clipboard operation
nebari copied to clipboard

[ENH] - Additional checks for the cli init stage

Open kcpevey opened this issue 2 years ago â€Ē 0 comments

Feature description

During the qhub init I used a projectname that had an underscore. I believe it wasn't until I got to the deploy stage that I saw a failure:

[terraform]: │ Error: "name" can only contain lowercase letters, numbers and hyphens
[terraform]: │
[terraform]: │   with module.kubernetes.google_container_cluster.main,
[terraform]: │   on modules/kubernetes/main.tf line 5, in resource "google_container_cluster" "main":
[terraform]: │    5:   name     = var.name
[terraform]: │
[terraform]: â•ĩ
[terraform]: ╷
[terraform]: │ Error: "account_id" ("this_deployment-dev") doesn't match regexp "^[a-z](?:[-a-z0-9]{4,28}[a-z0-9])$"
[terraform]: │
[terraform]: │   with module.kubernetes.google_service_account.main,
[terraform]: │   on modules/kubernetes/service_account.tf line 2, in resource "google_service_account" "main":
[terraform]: │    2:   account_id   = var.name
[terraform]: │
[terraform]: â•ĩ

The error message Error: "name" can only contain lowercase letters, numbers and hyphens is what we were hitting, but this originated from the projectname flag passed to qhub init so its very hard for an end user to comprehend how to resolve this.

I recommend we do the checks from the above errors ("lowercase letters, numbers and hyphens" and regexp "^a-z$") during the init stage so we can give users helpful error messages.

Value and/or benefit

Users are given clearer error messaging.

Anything else?

No response

kcpevey avatar Aug 17 '22 13:08 kcpevey