-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lib): add move workflows for specifying ids directly #3231
Conversation
Still need to shout out the new |
@Maed223 I think the upgrade guide is the best place for that 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Looks good to me 🚀
Got a few cleanup items / docs improvements, but would've been an approve otherwise ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only "blocking" one is my question in the refactoring examples :)
Co-authored-by: Ansgar Mertens <[email protected]>
I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
Adds a alternative workflow for performing resource moves by specifying resource ids directly.
The original workflow for resource moves didn't have (as of writing this) any bugs per say, yet some of the tradeoffs made in it's design made certain use cases quite difficult. As such, I made resource instance functions where the id to move to/from can be directly specified. Provides a better experience compared to using escape hatches, while avoiding potentially unhelpful abstraction in the targeting system.
In particular we saw in migrating the repository manager to use our new id generation that using the target system was incredibly cumbersome. In response to this use case, I've created an Aspect that will automatically perform the resource moves between the old id generation and the new for ease of upgrading past 0.17.
Resource Instance Function Additions
moveToId(id: string)
Moves the resource it is called upon to the resource corresponding to
id
moveFromId(id: string)
Move the resource corresponding to
id
to the resource it is called upon. Note that the resource being moved from must be marked as moved using the instance function.hasMoved()
.Id Migration Aspect
Added an Aspect (
MigrateIdsAspect
) to the lib that migrates ids from prev 0.17 to post 0.17 when the feature flag was removed. Uses the old logic for Id generation to resolve the original resource address and callsmoveFromId
with that old address.Should solve our issue in the repository manager quite nicely as well as any users in the same situation of upgrading their CDKTF version.
A screenshot of the new Aspect in action