modules icon indicating copy to clipboard operation
modules copied to clipboard

problems with validation for jetbrains gateway module folder

Open Forestsoft-de opened this issue 1 year ago • 2 comments
trafficstars

The error message is:

Error: Invalid value for variable
on main.tf line 248, in module "jetbrains_gateway":
  248:   folder         = "/home/coder/${local.folder_name}"
    ├────────────────
    │ var.folder is "/home/coder/foo/"
The folder must be a full path and must not start with a ~.
This was checked by the validation rule at .terraform/modules/jetbrains_gateway/main.tf:29,3-13.

The hcl is

locals {
    base_name = try(element(split("/", data.coder_parameter.git_repo.value), length(split("/", data.coder_parameter.git_repo.value)) - 1), "project/")
    #folder_name = try(local.base_name, "project/")
    folder_name = "foo/"

}
}
module "jetbrains_gateway" {
  source         = "registry.coder.com/modules/jetbrains-gateway/coder"
  version        = "1.0.13"
  agent_id       = coder_agent.main.id
  agent_name     =  "main"
  folder         = "/home/coder/${local.folder_name}"
  jetbrains_ides = ["PS", "GO", "IU", "PY", "WS"]
  default        = "PS"
}

i guessed there is a problem with the evaluation of folder_name and so i tried to set on the foldername directly.

BR Sebastian

Forestsoft-de avatar May 11 '24 14:05 Forestsoft-de

@Forestsoft-de the current regex at https://github.com/coder/modules/blob/dcd605c52efedbb09ac718968e2eeb11f8a1d80a/jetbrains-gateway/main.tf#L30 Does not accept a trailing /. That's why it's failing for you. We should allow accepting / as the last character for the folder

matifali avatar May 14 '24 11:05 matifali

I am running into the same issue when it comes cases where you only no the folder name of the project (like after doing the initial git clone) and you want to open it in Jetbrians later one.

michaelbrewer avatar May 23 '24 22:05 michaelbrewer