Skip to content

Conversation

@kacpersaw
Copy link
Contributor

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):

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

@github-actions github-actions bot added the stale This issue is like stale bread. label Dec 31, 2025
@github-actions github-actions bot closed this Jan 4, 2026
@kacpersaw kacpersaw reopened this Jan 8, 2026
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 to versioned types.

Changes:
- Add PUT /api/v2/workspacebuilds/{id}/state endpoint
- Add UpdateWorkspaceBuildState SDK method
- Add --no-build/-n flag to 'coder state push'
- Add confirmation prompt with --yes/-y skip option
- Add test for --no-build functionality

Fixes #21336
@kacpersaw kacpersaw force-pushed the kacpersaw/coder-state-no-build-flag branch from 63394f5 to 08a7cad Compare January 8, 2026 13:18
@kacpersaw kacpersaw force-pushed the kacpersaw/coder-state-no-build-flag branch from 08a7cad to ef7d449 Compare January 8, 2026 13:32
@github-actions github-actions bot removed the stale This issue is like stale bread. label Jan 9, 2026
@kacpersaw kacpersaw marked this pull request as ready for review January 12, 2026 10:51
- Remove warning and confirmation prompt (matches existing state push behavior)
- Use JSON body for PUT request (allows future extensibility)
- Add test assertion to verify no build is created with --no-build flag
@kacpersaw kacpersaw merged commit 6ca70d3 into main Jan 12, 2026
35 checks passed
@kacpersaw kacpersaw deleted the kacpersaw/coder-state-no-build-flag branch January 12, 2026 14:17
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 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.

Add --no-build flag to coder state push for state-only updates

2 participants