Issue with starting workspaces that were running for months.
Hello, today, my templates stopped working after months of being used.
Do you have any idea what is going on and how to fix it?
Here is the error log: https://paste.brcb.eu/ybejasaqut.yaml
And here is my main.tf: https://paste.brcb.eu/buhubymaxo.sh
18 Replies
<#1313784155561000961>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
@Šimon DJ Čecháček in the v2 of the provider,
coder_workspace.me.owner_*
variables have been removed in favor of the new coder_workspace_owner
data source
please see https://registry.terraform.io/providers/coder/coder/latest/docs/guides/version-2-upgrade#data-source-coder_workspace for instructionsI will check it
basically just add
data "coder_workspace_owner" "me" {}
next to the data "coder_workspace" "me" {}
definition you already have in your template and replace calls to deprecated valuesOkay, Will try 😄 Can I ask for help if I fail? 😄
of course!
I hope I updted it correctly, but now I end on
Error: Failed to install provider
Error while installing kreuzwerker/docker v3.0.2: unsuccessful request to
https://github.com/kreuzwerker/terraform-provider-docker/releases/download/v3.0.2/terraform-provider-docker_3.0.2_linux_amd64.zip:
504 Gateway Timeout
Maybe I got banned for too many attemps 😄
In the meaintime
Here is how I updated it:
94: username = data.coder_workspace_owner.me.name
95: weburl = "https://preview--main--${lower(data.coder_workspace_owner.me.name)}--${data.coder_workspace.me.owner}.coder.domain.tld"
544:
labels {
label = "coder.owner"
value = data.coder_workspace_owner.me.name
548:
labels {
label = "coder.owner_id"
value = data.coder_workspace_owner.me.id
}
Is tha correct? 😄
Okay, this is wrong:
weburl = "https://preview--main--${lower(data.coder_workspace.me.name)}--${data.coder_workspace.me.owner}.coder.artdev.space"
visibility_switch = data.coder_parameter.visibility.value == "false" ? "authenticated" : "public"
Can you help me fix this line please?replace
data.coder_workspace.me.owner
with data.coder_workspace_owner.me.name
otherwise looks good!Great!
This is hopefully the last one I am fighting with:
This is the current value:
env = ["CODER_AGENT_TOKEN=${data.coder_workspace_owner.me.session_token}"]
This is the original value:
env = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
Any idea what is wrong?oh no
the agent token is correct
you only have to replace stuff that starts with
data.coder_workspace_owner
so, coder_agent.main.token
is what you wantOkay, I understand that. But with what should be
data.coder_workspace.me.name
replaced? I am unable to understand it from the guide on terraform site you sent, I am sorry.
maybe data.coder_workspace_owner.me.full_name
?
Well, that is not correct as it ends on
Error: Unable to create container: Error response from daemon: Invalid container name (coder-radekchaloupka-radek chaloupka), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed
on main.tf line 579, in resource "docker_container" "workspace":
579: resource "docker_container" "workspace" {
Well, I remembered I created the template from a docker starter template, so I went there and copied the same stuff to update the variables, now I can build a template, but my startscript fails on permissions:
That code worked for months, so I am afraid is something to do witht the recent change, is there anything that changed permissions in coder workspace?
I think its because the coder command are no more running under the users username, but under coder username?
Yes, I ran the whole coder and startuo script under the individual user (owner of the workspace), now it runs under user coder and it makes issues as coder does not own the folder. I do not want to change the user structure asd that would break exisiting machines
Okay, for now I forced the older version of resource so our devs can work. I am unable to make it work :/Hi @Šimon DJ Čecháček We recommned always pinning provider versions in prodiction.
Also have you checked the upgrade guide at: https://registry.terraform.io/providers/coder/coder/latest/docs/guides/version-2-upgrade
It should help you migrate without a issue. IF you see any isssues, please let us know and we will update the guide.
Yeah i just learned that.
I read the tutorial and was able to build it. But my issue is now my user will not even create and everything runs under user coder, so folders cant be accessed and etc. There is no word about this in the guide
that is not something that should happen yeah
okay I would encourage you to start over with your existing template and redo the replacing
so basically this guide says:
-
data.coder_workspace.me.owner_id
-> data.coder_workspace_owner.me.id
- data.coder_workspace.me.owner
-> data.coder_workspace_owner.me.name
- data.coder_workspace.me.owner_name
-> data.coder_workspace_owner.me.full_name
- data.coder_workspace.me.owner_email
-> data.coder_workspace_owner.me.email
- data.coder_workspace.me.owner_groups
-> data.coder_workspace_owner.me.groups
- data.coder_workspace.me.owner_oidc_access_token
-> data.coder_workspace_owner.me.oidc_access_token
- data.coder_workspace.me.owner_session_token
-> data.coder_workspace_owner.me.session_token
all you should need to do is find and replace for these
hey @Šimon DJ Čecháček, any luck?Hi there. My Uni finals started, so I wan unable to test it. Will do ASAP and let you know
sounds good!