mirror of
https://github.com/coder/coder.git
synced 2026-06-03 04:58:23 +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
29 lines
547 B
Markdown
Generated
29 lines
547 B
Markdown
Generated
<!-- DO NOT EDIT | GENERATED CONTENT -->
|
|
# state push
|
|
|
|
Push a Terraform state file to a workspace.
|
|
|
|
## Usage
|
|
|
|
```console
|
|
coder state push [flags] <workspace> <file>
|
|
```
|
|
|
|
## Options
|
|
|
|
### -b, --build
|
|
|
|
| | |
|
|
|------|------------------|
|
|
| Type | <code>int</code> |
|
|
|
|
Specify a workspace build to target by name. Defaults to latest.
|
|
|
|
### -n, --no-build
|
|
|
|
| | |
|
|
|------|-------------------|
|
|
| Type | <code>bool</code> |
|
|
|
|
Update the state without triggering a workspace build. Useful for state-only migrations.
|