When a resource is moved between stacks in different projects we also
need to rewrite project part of the URNs. Do that here. Moving between
different projects already works by virtue of the requireStack function
supporting that when providing the fully qualified name of the stack.
There is some awkwardness here as old diy backends may not return a
project name, in which case we error out here. Curious if anyone has
thought about what to do here. Is erroring out the best we can do? What
happens if we don't rewrite the project name in this case?
---------
Co-authored-by: Will Jones <will@sacharissa.co.uk>
Implement a skeleton command for `pulumi state move`. This can so far
only more a single resource from one stack to another, including copying
the provider it needs, and leave valid state files behind.
These state files are not written to the backend yet, nor is there any
kind of UI. Further PRs will build on top of this.
The command is intentionally commented out so this can be merged
independently.
---
Based on discussions in the last retro, I'm trying something new here
and try to split the PR up some more into chunks that can be
individually merged, but are not completely ready yet. The code added
here is essentially dead code at this point, but provides a skeleton to
incrementally add pieces.
To give an idea of where this is headed, the next things I'm planning to
work on here are:
- Writing the state files to the backend
- Make sure this works with stacks from two different projects
- Add a preview phase that asks for user confirmation
- Add output for moved resources and warnings for dependencies that are
being broken
- Implement `--include-parents` flag
- Implement convenience flags (`--yes`, `--skip-preview` etc.)
I'd love some early thoughts on this PR, and also meta thoughts on
splitting PRs up this way.