Repository navigation
feat: add a per-template workspace rename setting - #27558
Conversation
Workspace renames were gated by a single deployment-wide flag, but the UI attributed the restriction to the template, and whether a rename is destructive genuinely depends on the template's Terraform. Adds templates.allow_workspace_renames, exposed on the template create and update APIs and in the template general settings form. Renames are permitted when the template opts in, or while the deprecated deployment flag is set. The deployment flag is now hidden and marked for removal in v2.41.0.
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here.
|
Documentation CheckUpdates Needed
Automated review via Coder Agents |
…workspace-renames
Main removed the dynamic parameters checkbox from the template settings form along with its `Link` and `docs` imports. The new rename setting uses both, so the merged tree failed to typecheck. Also renumbers the migration to 000557 to clear the 000554 collision.
…workspace-renames
Main claimed 000557 with connection_type_tunnel, which made the migrate driver reject the duplicate version and took down gen, lint, sqlc-vet, offlinedocs, test-e2e, and test-go-pg.
…workspace-renames Main added an agents_allowed template column that touches every place allow_workspace_renames does, so the two settings are interleaved in the SQL queries, dbgen, modelqueries, audit table, and codersdk structs. The template settings form was also demui'd, so the rename checkbox is rewritten in the new Checkbox/Label idiom. Also folds in review feedback: drops the specific removal version from the deprecated deployment option, softens the destructiveness wording in the column comment, SDK docs, and UI copy, and inlines the two-boolean rename check instead of wrapping it in a helper. Migration renumbered to 000573.
…workspace-renames
…enames' into lilac/template-allow-workspace-renames
…e renaming Replaces the two interaction-only stories with a vitest test file, so the rename setting is not carried as a pair of visual snapshots. Adds a "Workspace renaming" section under managing-templates covering why renames are off by default, how to check whether a template is safe, and how to enable the setting.
The pull_request-triggered workflows did not fire for ae736b0.
…workspace-renames
| Flag: "allow-workspace-renames", | ||
| Env: "CODER_ALLOW_WORKSPACE_RENAMES", | ||
| Default: "false", | ||
| Hidden: true, |
There was a problem hiding this comment.
Nit: sharing a small issue found by local AI agent (it is non-blocking but nice to fix if that makes sense):
Can we drop Hidden: true here?
The flag still works, and for some deployments it's the only reason renames are enabled right now. Hiding it removes it from coder server --help, the CLI reference, and the configuration reference all at once, so an operator who has CODER_ALLOW_WORKSPACE_RENAMES=true set today has no way to find out it's deprecated.
We don't need Hidden to get the deprecation styling. scripts/configdocgen already treats any option whose description starts with "Deprecated" as deprecated — it sorts it to the end of the section and bolds the marker. Your description already starts that way.
I tried it locally: deleting just this line brings the section back as Deprecated: use the per-template ..., and nothing else on the page moves. Needs a make gen for the two goldens and the two docs pages.
There was a problem hiding this comment.
afaict there aren't any options that are deprecated but don't set Hidden
BobbyHo
left a comment
There was a problem hiding this comment.
lgtm, just shared a NIT (non-blocking) comment.
Resolves DEVEX-674.
Workspace renames were gated by a single deployment-wide flag, but the workspace settings UI already told users the restriction came from the template. Whether a rename is destructive genuinely depends on the template's Terraform, so the control belongs there.
templates.allow_workspace_renames, defaulting tofalse, exposed on the template create/update APIs and as a checkbox in template general settings.--allow-workspace-renames/CODER_ALLOW_WORKSPACE_RENAMESis now hidden and marked for removal in v2.41.0.Design notes
Reconciliation. Effective permission is
deployment.AllowWorkspaceRenames || template.allow_workspace_renames. The deployment flag force-enables renames for every template while set. The alternative, seeding new templates from the flag, was rejected as harder to reason about.Deprecation.
serpent'sUseInsteadonly accepts other serpent options, so it cannot point at a template setting. The deprecation notice lives in the option description instead.Not license-gated. Treated like
allow_user_cancel_workspace_jobs, notrequire_active_version.Rejected follow-up: static "rename safe" detection at template import. The idea was to scan the plan for references to
data.coder_workspace.*.nameand auto-enable renames when absent.tfjson.Plan.Configdoes exposeExpression.Referencesand is already parsed by the provisioner, but Terraform's JSON config output omitslocalsentirely. A template doing:would scan as rename-safe and is not. A false "safe" causes exactly the data loss this setting exists to prevent. Graph reachability catches locals but cannot distinguish
.namefrom.start_count, which nearly every template uses, so it would report almost nothing as safe. Manual opt-in only.🤖 Generated by Coder Agents on behalf of @aslilac.