mirror of
https://github.com/coder/coder.git
synced 2026-06-03 13:08:25 +00:00
6ca70d3618
## Summary
Adds a `--no-build` flag to `coder state push` that updates the
Terraform state directly without triggering a workspace build.
## Use Case
This enables state-only migrations, such as migrating Kubernetes
resources from deprecated types (e.g., `kubernetes_config_map`) to
versioned types (e.g., `kubernetes_config_map_v1`):
```bash
coder state pull my-workspace > state.json
terraform init
terraform state rm -state=state.json kubernetes_config_map.example
terraform import -state=state.json kubernetes_config_map_v1.example default/example
coder state push --no-build my-workspace state.json
```
## Changes
- Add `PUT /api/v2/workspacebuilds/{id}/state` endpoint to update state
without triggering a build
- Add `UpdateWorkspaceBuildState` SDK method
- Add `--no-build`/`-n` flag to `coder state push`
- Add confirmation prompt (can be skipped with `--yes`/`-y`) since this
is a potentially dangerous operation
- Add test for `--no-build` functionality
Fixes #21336
18 lines
415 B
Plaintext
18 lines
415 B
Plaintext
coder v0.0.0-devel
|
|
|
|
USAGE:
|
|
coder state push [flags] <workspace> <file>
|
|
|
|
Push a Terraform state file to a workspace.
|
|
|
|
OPTIONS:
|
|
-b, --build int
|
|
Specify a workspace build to target by name. Defaults to latest.
|
|
|
|
-n, --no-build bool
|
|
Update the state without triggering a workspace build. Useful for
|
|
state-only migrations.
|
|
|
|
———
|
|
Run `coder --help` for a list of global options.
|