You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I create a template with var1=foo as a sensitive (template) variable, I have no way to update the template and change the template to var1=bar. Coder does not support reading from .tfvars files, or TF_VAR environment variables during coder templates create or coder templates update.
Related #1751, but also encompasses updating an existing variable. #1541 allows you to specify vars from a file, but does no work for updating workspaces.
Why do you want this feature?
Editing template variables is a key part of iterating on a template. To name specific workflows:
patching/updating base container images for Docker and K8s workspaces
rotating/updating the API key for a cloud provider
migrating docker host for workspaces
fixing broken templates due to invalid (or dynamic) var
Are there any workarounds to get this functionality today?
Hardcoding (and committing) secret variables and environment information.
Some type of sed magic to inject variables into .tf via CLI scripts. Yikes
Param values are currently associated to Templates, not the versions. This causes an issue for past template versions as if you upload new param values for a template, it also updates old template versions. So we should scope values to the version only
Decision:
Remove template parameter scope so all param values are scoped to the template version job
There was some convo in slack for UX on this. It would be nice to grab the lasttemplate_version values.
However this implies some assumptions. The first being, would I grab the "current" value for the same param from the active template version? Or the most recent template version? (These can be different)
UX wise, this also requires fetching params that are intentionally secrets to show the user what the "current" value is. The alternative is just do something like "Use previous value", but don't show what that value is (?).
For the first iteration, to simplify everything and fix the bug, does anyone object to copying the current coder template create flow of prompting the user for each parameter value?
I know @kylecarbs mentioned having to re-input secrets could be awkward, but I think requiring the user that updates the template active version to have the secret is ok. And from a security POV, if you don't have the secret, you could use the "current" value syntax to leak the secret by uploading a terraform file that exposes the secret to the workspace somehow.
For the first iteration, to simplify everything and fix the bug, does anyone object to copying the current coder template create flow of prompting the user for each parameter value?
IMO, this would not be super ideal. Since there is no .tfvars support in Coder, I would have to manually add the vars each time I'm debugging a template (or hardcode them during the "buildout" phase of a template). e.g
for broken_or_wip_template
vim main.tf # edit terraform
coder templates update my-template # add new template version# copy/paste all vars, even if specified in previous version
coder workspace <create/update> my-test-workspace
if (fixed) break;
If 0 new variable names are introduced in a version, I think skipping the variable screen is a sane default.
$ coder templates update ben-linux
# Using template parameters from previous template version. To# always prompt for params, use --always-prompt
For editing/adding new values, would it be difficult to mimic the aws configure behavior? Specifically, it
iterates through all variables, shows a tiny bit of the parameter
easy UX for overriding or using existing parameter
Will this also apply for workspaces when new parameters are added to a template? For workspaces, it seems saner to only prompt when new variables are introduced and have an --edit-params flag to iterate through everything, like aws configure.
$ coder templates update ben-linux
# Using template parameters from previous template version. To
# always prompt for params, use --always-prompt
# All new params are always prompted.
# All removed params will just paste some informational log line
Ah, I just meant the way aws configure works. I was not suggesting add a coder configure command.
Showing part of the secret still means exporting the secret which I would like to avoid. I could replace the characters with *'s?
Makes sense to me 👍🏼
$ coder templates update ben-linux
# Using template parameters from previous template version. To# always prompt for params, use --always-prompt# All new params are always prompted.# All removed params will just paste some informational log line
Activity
[-]Feat: edit template variables after creation[/-][+]Edit template variables after creation[/+]Emyrk commentedon Jun 13, 2022
I think I am seeing this too. Just to clarify, the bug is you cannot add variables with
coder template update?bpmct commentedon Jun 13, 2022
Correct
Emyrk commentedon Jun 14, 2022
This seems important, I'm going to take a look
misskniss commentedon Jun 14, 2022
@Emyrk will you add your notes from the slack convo into this issue?
Emyrk commentedon Jun 14, 2022
Notes from slack:
Param values are currently associated to Templates, not the versions. This causes an issue for past template versions as if you upload new param values for a template, it also updates old template versions. So we should scope values to the version only
Decision:
templateparameter scope so all param values are scoped to the template version jobEmyrk commentedon Jun 14, 2022
@kylecarbs @bpmct
There was some convo in slack for UX on this. It would be nice to grab the last
template_versionvalues.However this implies some assumptions. The first being, would I grab the "current" value for the same param from the
activetemplate version? Or the most recent template version? (These can be different)UX wise, this also requires fetching params that are intentionally secrets to show the user what the "current" value is. The alternative is just do something like "Use previous value", but don't show what that value is (?).
For the first iteration, to simplify everything and fix the bug, does anyone object to copying the current
coder template createflow of prompting the user for each parameter value?I know @kylecarbs mentioned having to re-input secrets could be awkward, but I think requiring the user that updates the template active version to have the secret is ok. And from a security POV, if you don't have the secret, you could use the "current" value syntax to leak the secret by uploading a terraform file that exposes the secret to the workspace somehow.
EDIT: We can update the UX in the future
kylecarbs commentedon Jun 14, 2022
I'm not opposed, but I'd defer to @bpmct's POV.
bpmct commentedon Jun 14, 2022
IMO, this would not be super ideal. Since there is no
.tfvarssupport in Coder, I would have to manually add the vars each time I'm debugging a template (or hardcode them during the "buildout" phase of a template). e.gIf 0 new variable names are introduced in a version, I think skipping the variable screen is a sane default.
For editing/adding new values, would it be difficult to mimic the
aws configurebehavior? Specifically, ithttps://asciinema.org/a/lESUYiOkdV0VJk1hu8g2M0any
Will this also apply for workspaces when new parameters are added to a template? For workspaces, it seems saner to only prompt when new variables are introduced and have an
--edit-paramsflag to iterate through everything, likeaws configure.Emyrk commentedon Jun 14, 2022
@bpmct do you think using the parameters files is a valid workflow?
Showing part of the secret still means exporting the secret which I would like to avoid. I could replace the characters with
*'s?Emyrk commentedon Jun 14, 2022
I think I am just confused on the
aws configurebehavior. Is that editing an existing template?So the flow is this?
I can do this now:
bpmct commentedon Jun 14, 2022
Yep. Just like .tfvars :)
Ah, I just meant the way
aws configureworks. I was not suggesting add acoder configurecommand.Makes sense to me 👍🏼
Yeah sounds fantastic
Emyrk commentedon Jun 17, 2022
#2397 done!