-
Notifications
You must be signed in to change notification settings - Fork 40
feat(cli): allow change set imports resources that already exist #447
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(cli): allow change set imports resources that already exist #447
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #447 +/- ##
==========================================
+ Coverage 78.95% 78.98% +0.03%
==========================================
Files 46 46
Lines 6979 6994 +15
Branches 774 776 +2
==========================================
+ Hits 5510 5524 +14
- Misses 1451 1452 +1
Partials 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Pending adding unit and integ tests |
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.
Please also add this feature to toolkit-lib/toolkit/toolkit.ts
Is there any downside to just switching this on by default? |
Do we also already have this feature in |
For my understanding, is this for programmatic SDK call? |
I think it's not enabled by default because this is also the CFN behaviour and CDK deploy behaviour. CDK deploy already supports |
yes |
Correct, that's for the Programmatic Toolkit. Unfortunately we have some unavoidable duplication at the moment. |
The main risk is if the real resource and the CDK definition don't match. Would have to test, but I think CFN can get in a weird state then or at least it's unexpected if an existing (production) resource is changed. |
...nteg/tests/cli-integ-tests/cdk-cdk-diff--import-existing-resources-shows-import.integtest.ts
Outdated
Show resolved
Hide resolved
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.
Almost there.
disable flag when local template chore: self mutation Signed-off-by: github-actions <[email protected]> update cdk diff output add unit and integ tests to import feature add an alias to the method add README changes address build errors address PR feedbacks chore: self mutation Signed-off-by: github-actions <[email protected]>
I just noticed this feature got merged (finally after aws/aws-cdk#32831)! Great job team! I'll write a blog about this 😄 |
Allow
cdk diff
command to create a change set that imports existing resources.The current
cdk diff
command implicitly callsCloudFormation change set creation, providing high-level details such as "add", "delete", "modify", "import",
and etc. like the following:
However, when the resource is meant to be imported, the
cdk diff
command still shows this as add. Addingcdk diff --import-existing-resources
flag to show the new resource being imported instead ofadd
.Here is the underlying CFN change set JSON output
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license