Skip to content

Conversation

@kacpersaw
Copy link
Contributor

backport #21374 to 2.29

feat(cli): add --no-build flag to state push for state-only updates #21374

kacpersaw added a commit that referenced this pull request Jan 20, 2026
fix: update boundary version #21290

required by #21561

Co-authored-by: Yevhenii Shcherbina <evgeniy.shcherbina.es@gmail.com>
…21374)

Adds a `--no-build` flag to `coder state push` that updates the
Terraform state directly without triggering a workspace build.

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
```

- 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

(cherry picked from commit 6ca70d3)
@kacpersaw kacpersaw force-pushed the kacpersaw/backport-no-build-flag-2.29 branch from cdc976b to 1a312ae Compare January 20, 2026 10:21
@kacpersaw kacpersaw marked this pull request as ready for review January 20, 2026 13:57
@david-fraley david-fraley merged commit 2e2d0dd into release/2.29 Jan 20, 2026
52 of 56 checks passed
@david-fraley david-fraley deleted the kacpersaw/backport-no-build-flag-2.29 branch January 20, 2026 21:46
@github-actions github-actions bot locked and limited conversation to collaborators Jan 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants