-
Notifications
You must be signed in to change notification settings - Fork 891
Sourcing Terraform Variables from Within Coder #8279
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
Comments
Ah interesting. I'd expect that Coder wouldn't prompt for these if they are set with |
Frankly speaking |
Version: 0.24.1
Original Discord Thread
Problem
I have set specific
TF_VAR
's (environment variables) inside of my coder instance running in Kubernetes and I want the terraform templates to use them. However when I create new templates using these variables coder complains and wants me to pass them in through the CLI with the--variable flag
. The strange thing is that I can see the special env variables inside Coder are being read because all current templates showwhen starting up (and I also see this when doing a template push with either garbage variable data or default values set for the variables in the tf). No matter what I have tried though, Coder doesn't actually use the
TF_VAR
's it retrieves. The only way I can get these variables to be used is through this less than idea hack:Proposal
I'm not sure if I am doing something wrong (doesn't seem like it), if this is a bug, or if this is functionality that needs to be added. Either way, I would like for templates to have the ability to first check for applicable environment variables inside of Coder and use them before complaining that a user has not provided the required variables or just uses the default value set in the Terraform. I think what would make most sense is that by default when uploading a template to Coder, it first uses
TF_VAR
's already defined and then relies on the--variable
flag for anything missing. If a user passes a variable through the flag that is already inside Coder then it overwrites that value for this template.Images
Whenever a workspace is started:


When trying to upload a template that uses the variables inside Coder:

The text was updated successfully, but these errors were encountered: