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
{{ message }}
Repository navigation
Support passing tfvars files for terraform based provisioner workspaces #1590
Terraform supports using a tfvars. It would be nice if you could do a coder workspaces create --tfvars=my.tfvars.
Currently we are aiming to support yaml/json files to answer all prompts (#1377, #1541).
Supporting tfvars gets a bit complicated. For one, ideally we do not interpret/parse the tfvars, and pass it "as is" to terraform apply/plan. One solution is to support passing a new ParameterDestination type file, which lets writing files to the directory where terraform is run. This could possibly be a security issue though, as now users can not only set all parameters, but are writing arbitrary files to the provisionerd node :(.
Options:
Parse the tfvars first and do some sanity checks before uploading the file. This would require us to understand the file extension type, rather than a generic "file upload param".
Why do you want this feature?
terraform apply and coder workspace create become "synonymous" for sake of testing.
Are there any workarounds to get this functionality today?
We maybe don't even need to parse the parameters ourselves at all. What if we just included the secrets directly in the archive? Then Terraform would pick them up automatically, and we would perform zero magic.
We shouldn't have a top level argument that is Terraform-specific. We can do something like --var name=value and handle this in a provisioner-independent way.
@ketang there is different ideas on how to implement this, but we currently support yaml var files. So any other format would just be "in addition too" the general format.
Terraform already supports tfvars, so a template manager can just include a tfvar file in their archive when it's uploaded. That should be supported already (maybe we'll have to add --tfvars-file to our provision step?).
maybe we'll have to add --tfvars-file to our provision step?
Do they directly invoke a Terraform-specific provisioner? If it's through an abstraction, then I have the same comment as above re TF-specific variables and arguments in provisioner-agnostic interfaces and code.
changed the title [-]Feat: Support passing `tfvars` files for terraform based provisioner workspaces[/-][+]Support passing `tfvars` files for terraform based provisioner workspaces[/+]on Jun 7, 2022
Activity
Emyrk commentedon May 19, 2022
@kylecarbs Brainstorming with @AbhineetJain on this. Might just support yaml/json at first, then figure this one out next.
kylecarbs commentedon May 19, 2022
We maybe don't even need to parse the parameters ourselves at all. What if we just included the secrets directly in the archive? Then Terraform would pick them up automatically, and we would perform zero magic.
Emyrk commentedon May 19, 2022
When you say
secretsdo you mean all params?tjcran commentedon May 30, 2022
@Emyrk i'm inclined to say this is a
nice to havefor now. Any reason I should bump this up to sooner?ketang commentedon May 31, 2022
We shouldn't have a top level argument that is Terraform-specific. We can do something like
--var name=valueand handle this in a provisioner-independent way.Emyrk commentedon May 31, 2022
@ketang there is different ideas on how to implement this, but we currently support yaml var files. So any other format would just be "in addition too" the general format.
kylecarbs commentedon May 31, 2022
Terraform already supports
tfvars, so a template manager can just include atfvarfile in their archive when it's uploaded. That should be supported already (maybe we'll have to add--tfvars-fileto our provision step?).ketang commentedon May 31, 2022
Do they directly invoke a Terraform-specific provisioner? If it's through an abstraction, then I have the same comment as above re TF-specific variables and arguments in provisioner-agnostic interfaces and code.
[-]Feat: Support passing `tfvars` files for terraform based provisioner workspaces[/-][+]Support passing `tfvars` files for terraform based provisioner workspaces[/+]kylecarbs commentedon Aug 24, 2022
This seems like something we should wait for customers to request before we implement any parsing logic. Closing for now.