feat(cli): add --no-build flag to state push for state-only updates #21374
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
--no-buildflag tocoder state pushthat 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.jsonChanges
PUT /api/v2/workspacebuilds/{id}/stateendpoint to update state without triggering a buildUpdateWorkspaceBuildStateSDK method--no-build/-nflag tocoder state push--yes/-y) since this is a potentially dangerous operation--no-buildfunctionalityFixes #21336