- Notifications
You must be signed in to change notification settings - Fork928
feat: Read params from file for template/workspace creation#1541
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@@ -18,6 +20,7 @@ func create() *cobra.Command { | |||
var ( | |||
workspaceName string | |||
templateName string | |||
parameterFile string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
tfvars is the standard way to handle this with Terraform.
I'd prefer to not have our own solution, because that'd remove the ability for users to doterraform apply
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@kylecarbs that assumes we use terraform, but our cli should be terraform agnostic right?
Alsotfvars
is just HCL or yaml. So we could just support multiple file types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Developers also won't have thetf
file when runningcoder workspace create
, only the person who made the template will have thetf
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We can be Terraform agnostic while still consumingtfvars
. Latching onto the existing Terraform ecosystem is a much better user experience than forking it with our own parameter format.
I don't believe it's necessary to have atfvars
equivalent when creating a workspace. Or at least, we haven't seen it as a problem yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Issue#1377 mentions creating workspaces using parameter files, which is why I went with a non-tfvars approach. However,#1426 does talk about doing this for templates. Would you recommend solving both problems using different approaches or only work on#1426 (template creation via file) viatfvars
? Let me quickly check how feasible usingtfvars
for template creation is.
AbhineetJainMay 18, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is there a documented flow of how the customers would useterraform apply
when setting up templates? I tried using thetfvars
file as follows:
$ terraform init$ terraform apply -var-file="<path_to_tfvars>"...Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
It did not create a template and callingcoder templates create
after this still asked me for input, so I am not sure what the actual flow should be.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
c7bb16f
todc80543
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Interestingly, the error I am encountering in the Windows tests is a known Go issue:golang/go#52986. Trying a workaround. |
AbhineetJain commentedMay 20, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
The fix does not help. What is the precedent in these cases? Revert the |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
86b1028
to1491620
Compare* Read params from file for template/workspace creation* Use os.ReadFile* Refactor reading params into a separate module* Add comments and unit tests* Rename variable* Uncomment and fix unit test* Fix comment* Refactor tests* Fix unit tests for windows* Fix unit tests for Windows* Add comments for the hotfix
Uh oh!
There was an error while loading.Please reload this page.
This allows users to use parameter files for variable input during template and workspace creation.
Subtasks
Fixes#1377