Skip to content

During auto shutdown, Coder submits old variables which can break the ability to shutdown #7073

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

Closed
elliot-graebert-skydio opened this issue Apr 10, 2023 · 9 comments

Comments

@elliot-graebert-skydio
Copy link

I believe the repro is this:

  • Create a template with an input variable
  • Create a workspace and set the input variable to "foo"
  • Update the template (but not the workspace) to delete the input variable
  • Wait for auto-shutdown to happen

I believe you'll get an error that looks like the following:

A variable named "<X>" was assigned on the command line, but the root module does not declare a variable of that name. To use this value, add a "variable" block to the configuration.```

This ends up failing the terraform plan for the shutdown, and thus the workspace is not offline.
@kylecarbs
Copy link
Member

We shall fix this!

cc @mtojek

@mtojek
Copy link
Member

mtojek commented Apr 11, 2023

Taking a look

@mtojek
Copy link
Member

mtojek commented Apr 11, 2023

I reproduced a bit different issue, but I believe that the root cause is the same.

What I did is:

  1. Create a new template. It doesn't need to use variables for now.
  2. Create a workspace using the above template.
  3. Set the autostop TTL=300s using API.
  4. Push a new template revision with the new required variable (no default):
variable "region2" {
  description = "This is region."
  type        = string
}
  1. Wait for the autostop to kick-off:

Screenshot 2023-04-11 at 14 02 21

@mtojek
Copy link
Member

mtojek commented Apr 11, 2023

Root cause: it seems to be related to the template version that is used. For some reason (a bug?), autostop uses the latest template version instead of the one that is assigned before the autostop event.

@johnstcn
Copy link
Member

Context: #6049 modified the autostart behaviour to automatically update the workspace to the latest template version. Previously, it would use the template version of the last successful build.

@mtojek
Copy link
Member

mtojek commented Apr 11, 2023

@bpmct It seems that we have conflicting assumptions. Do you think that we should revert the auto-update? Otherwise, it will be either confusing for users ("did it update or not") or it will keep failing.

@bpmct
Copy link
Member

bpmct commented Apr 11, 2023

I see. Why are we updating the version on stop instead of the next start?

I guess we can disable the "auto-update" behavior for now, but I know some users are hoping to use Coder to ensure developers all stay on the same version. The behavior I would (eventually) expect is:

  • Coder auto stops workspace with existing version
  • During auto start, Coder attempts to use new version
  • If there are new parameters, a developer will be notified when they SSH, visit via VS Code, or on the dashboard that they need to set new values for the workspace to start.
  • A template admin can disable auto-updating and also allow developers to switch to any version of a template they'd like.

Seems like this would require significant rework though, so let's revert the auto-update for now.

@mtojek
Copy link
Member

mtojek commented Apr 11, 2023

FYI "Autoupdate" has been reverted.

@mtojek
Copy link
Member

mtojek commented Apr 17, 2023

I guess that I can close it now.

@mtojek mtojek closed this as completed Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants