coder_agent.main.token is not valid in windows workspace
Hey guys, I'm working on setting up coder with GitLab external-auth on a windows workspace, provisioned via Azure. After a lot of reading, I've found that I need to pipe in
CODER_AGENT_TOKEN and CODER_AGENT_URL so I can have the my GIT_ASKPASS script dyamically fetch the token for GitLab - I've done that as follows in my tf file:
And then inside of Initialize.ps1.tftpl:
When I RDP into my workspace, I can run Get-ChildItem Env: and see that both of those variables are in fact set. However, when I run coder external-auth access-token gitlab, I hit the following error:
It seems that the value of coder_agent.main.token is not valid for whatever reason. If you have any pointers as to why that might be, I'd be super grateful. Thank you so much!9 Replies
<#1406392819349848175>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
are you using
data "coder_external_auth" "gitlab" in your template?
You need that in template and then authentciate with gitlab to use the external-auth commandYup, I do:
@Tom how are you logging in to the Coder CLI?
I wasn't sure you had to be (I thought external auth might not need it), but I tried using
coder_login just to rule it out, and it didn't seem to work at all on windows
So I instead ended up running coder login --token="${CODER_USER_TOKEN}" --url="${CODER_DEPLOYMENT_URL}" on startup which led to coder whoami returning my user.
I piped the user token and deployment URL in through the TF template:
After doing all that, the result of coder external-auth access-token gitlab was still the same as before I did it 😥can you run
coder whoami?Yeah, it returns my user
Can you move this to a github issue in
coder/terraform-provider-coder ?