Skip to content

rich parameters: user environment variable input #5981

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
Tracked by #6075
bpmct opened this issue Feb 2, 2023 · 14 comments
Closed
Tracked by #6075

rich parameters: user environment variable input #5981

bpmct opened this issue Feb 2, 2023 · 14 comments
Labels
parameters Area: parameters

Comments

@bpmct
Copy link
Member

bpmct commented Feb 2, 2023

I'm sure we can probably think of a better name but would be nice to have some type of parameter that lets users enter the environment variables for their workspace for example.

Open questions:

  • is there a way to hide these from the UI?
@mtojek
Copy link
Member

mtojek commented Feb 3, 2023

Is it related to #5980? I have a feeling that it overlaps a bit.

@bpmct
Copy link
Member Author

bpmct commented Feb 3, 2023

Yeah, I think it's related but wanted a separate issue for workspace-scoped env vars. (I was assuming this would be a parameter type like bool, string: but key_value) where the other one was Terraform variables.

@mtojek
Copy link
Member

mtojek commented Feb 3, 2023

Ok, I see :) I assumed that every variable would have a type and format too, even if they are strict Terraform variables, which could be a string type without format restrictions.

@mtojek mtojek added the parameters Area: parameters label Feb 28, 2023
@github-actions
Copy link

This issue is becoming stale. In order to keep the tracker readable and actionable, I'm going close to this issue in 7 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label May 30, 2023
@zifeo
Copy link

zifeo commented Jun 5, 2023

@mtojek Using the terraform variable, we could easily set secrets at template push time. I understand this is now deprecated, and that there is no alternative. Is this similar to this ticket or is there another tracking one?

@github-actions github-actions bot removed the stale This issue is like stale bread. label Jun 6, 2023
@mtojek
Copy link
Member

mtojek commented Jun 6, 2023

I understand this is now deprecated, and that there is no alternative.

Incorrect. You can still use Terraform variables, but with feature_use_managed_variables provider flag.

If you set sensitive = true, you can use the variable to pass secrets.

@zifeo
Copy link

zifeo commented Jun 6, 2023

@mtojek I have tried and tried, the coder cli does not take into account the TF_VAR_X anymore with managed variables. Neither was I able to get a similar behaviour using coder_parameter data source. Is there a doc on what is expected to work with env var?

@mtojek
Copy link
Member

mtojek commented Jun 6, 2023

You can try to use values.yml file:

region: us-east-1
secret_field: magic
cpu: 1

then:

coder templates push my-awesome-template -d my-template-directory --variables-file values.yml

@zifeo
Copy link

zifeo commented Jun 6, 2023

@mtojek we use Lade to inject secret as temporary environment variables. Mounting a file is more cumbersome, therefore my comment about the ability to load secrets via env vars.

@zifeo
Copy link

zifeo commented Jun 12, 2023

@mtojek I saw that coder 0.24.x was released with all legacy parameters removed. Do you have an idea when loading parameter through env var will be back on the roadmap?

@mtojek
Copy link
Member

mtojek commented Jun 12, 2023

I have tried and tried, the coder cli does not take into account the TF_VAR_X anymore with managed variables. Neither was I able to get a similar behaviour using coder_parameter data source.
we use Lade to inject secret as temporary environment variables. Mounting a file is more cumbersome, therefore my comment about the ability to load secrets via env vars.

I can confirm that it is not on the roadmap now, and we don't plan to work on it in the nearest future. I understand that using a config file is unfortunate for your case.

EDIT:

If you want to prepare a community contribution, we will gladly review it!

@zifeo
Copy link

zifeo commented Jun 12, 2023

@mtojek I have given a try, and it seems there is still different than previous way to load env vars. The values.yml I am using is following your guidance. Yet during the template push, I get:
image

Looks like the variables may not be present during that step of the build? Also reading the doc again, it seems that template user may see those values (or afaik). Is that correct?

@mtojek
Copy link
Member

mtojek commented Jun 13, 2023

Looks like the variables may not be present during that step of the build? Also reading the doc again, it seems that template user may see those values (or afaik). Is that correct?

Yes, unless you mark them as sensitive.

BTW It would be easier to guide you if you share your template and the command you're calling.

@matifali
Copy link
Member

@mtojek and @bpmct, I think this issue is no longer relevant.

@mtojek mtojek closed this as completed Nov 13, 2023
@mtojek mtojek closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parameters Area: parameters
Projects
None yet
Development

No branches or pull requests

4 participants