pulumi/pkg/backend/filestate
Joe Duffy 01d0d64e84
Correctly rename stack files during a rename (#5812)
* Correctly rename stack files during a rename

This fixes pulumi/pulumi#4463, by renaming a stack's configuration
file based on its stack-part, and ignoring the owner-part. Our
workspace system doesn't recognize configuration files with fully
qualified names. That, by the way, causes problems if we have
multiple stacks in different organizations that share a stack-part.

The fix here is simple: propagate the new StackReference from the
Rename operation and rely on the backend's normalization to a
simple name, and then use that the same way we are using a
StackReference to determine the path for the origin stack.

An alternative fix is to recognize fully qualified config files,
however, there's a fair bit of cleanup we will be doing as part of
https://github.com/pulumi/pulumi/issues/2522 and
https://github.com/pulumi/pulumi/issues/4605, so figured it is best
to make this work the way the system expects first, and revisit it
as part of those overall workstreams. I also suspect we may want to
consider changing the default behavior here as part of
https://github.com/pulumi/pulumi/issues/5731.

Tests TBD; need some advice on how best to test this since it
only happens with our HTTP state backend -- all integration tests
appear to use the local filestate backend at the moment.

* Add a changelog entry for bug fix

* Add some stack rename tests

* Fix a typo

* Address CR feedback

* Make some logic clearer

Use "parsedName" instead of "qn", add a comment explaining why
we're doing this, and also explicitly ignore the error rather
than implicitly doing so with _.
2020-12-01 16:55:48 -08:00
..
backend.go Correctly rename stack files during a rename (#5812) 2020-12-01 16:55:48 -08:00
backend_test.go Fix panic with logs (#5503) 2020-10-02 14:09:34 -07:00
bucket.go Breaking changes due to Feature 2.0 work 2020-04-14 09:30:25 +01:00
bucket_test.go Fix 'pulumi stack ls' on Windows (#4094) 2020-03-18 13:57:25 -07:00
gcpauth.go Breaking changes due to Feature 2.0 work 2020-04-14 09:30:25 +01:00
snapshot.go Breaking changes due to Feature 2.0 work 2020-04-14 09:30:25 +01:00
stack.go Correctly rename stack files during a rename (#5812) 2020-12-01 16:55:48 -08:00
state.go Allow pulumi stack export to decrypt secrets (#4046) 2020-05-11 19:16:30 +01:00