Skip to content
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

problems with validation for jetbrains gateway module folder #247

Open
Forestsoft-de opened this issue May 11, 2024 · 1 comment
Open

problems with validation for jetbrains gateway module folder #247

Forestsoft-de opened this issue May 11, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Forestsoft-de
Copy link

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

@coder-labeler coder-labeler bot added the waiting-for-info Further information is requested label May 11, 2024
@matifali matifali transferred this issue from coder/coder May 12, 2024
@matifali matifali added bug Something isn't working and removed waiting-for-info Further information is requested labels May 12, 2024
@matifali
Copy link
Contributor

@Forestsoft-de the current regex at

condition = can(regex("^(?:/[^/]+)+$", var.folder))

Does not accept a trailing /. That's why it's failing for you. We should allow accepting / as the last character for the folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants