-
Notifications
You must be signed in to change notification settings - Fork 458
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
Improve Experience of Renaming / Moving Constructs #219
Comments
For the git algorithm, what would you be comparing to? |
I think a plan file contains all the information which is required, so there shouldn't be a need to pull the entire state from remote backends. |
There is something available directly in Terraform: https://www.terraform.io/language/modules/develop/refactoring |
Idea: To make simple renaming easier we could add a helper that creates a const api = new AppsyncGraphqlApi(this, 'GraphQL', {
authenticationType: 'AMAZON_COGNITO_USER_POOLS',
name: 'cdk.dev',
schema,
userPoolConfig: [{
defaultAction: 'DENY',
userPoolId: userPool.id!
}]
})
rename(api, "GraphQL1")
// or
api.rename("GraphQL1") // beware name collisions with a potential rename argument/attribute
// or
oldNameWas(api, "GraphQL0") |
That would solve all my problems.
Alternatively could just call it by its tf name const api = new AppsyncGraphqlApi(this, 'GraphQL1', {
...
}).moved("GraphQL") or const api = new AppsyncGraphqlApi(this, 'GraphQL1', {
...
}).movedFrom("GraphQL") |
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Community Note
Description
Given the following Construct
When renaming its Construct id from
GraphQL
toGraphQL1
the resource gets recreated by Terraform since the Terraform resource name changes fromcdkdev_GraphQL_E4BC4DB4
tocdkdev_GraphQL1_A79E37DD
. This applies not only to renaming, but also when refactoring and moving a Construct into another Construct and therefore changing its position in the Construct tree.Terraform Plan excerpt
I think it would desirable to make this a smoother experience. There are various approaches to this, here are two which came to my mind:
The text was updated successfully, but these errors were encountered: