Commit Graph

3 Commits

Author SHA1 Message Date
Thomas Gummerer 2f4b26b681
rewrite the URN when resources are being moved between projects ()
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>
2024-07-01 17:36:11 +00:00
Thomas Gummerer 24ce87b566
implement skeleton command for `pulumi state move` ()
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.
2024-06-28 09:43:19 +00:00
Ian Wahbe e31b63d9fd
Move resource.URN to urn.URN ()
This change follows on https://github.com/pulumi/pulumi/pull/15157, to
allow https://github.com/pulumi/pulumi/pull/15145 to be imported by
`resource`. This is the last module import cycle change necessary for
`resource` to import `property` (as in
https://github.com/pulumi/pulumi/pull/15145).

Like https://github.com/pulumi/pulumi/pull/15157, this change is *100%
backwards* compatible.
2024-03-14 15:28:32 +00:00