-
Notifications
You must be signed in to change notification settings - Fork 4k
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): hotswap support for resources in nested stacks #18950
Conversation
…sure that resource lookups work
…ent resource type (with the same logical ID) results in a full deployment, and vice versa
…K calls or duplicated code
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.
I just skimmed for now (this is quite complex), but one thing stuck out to me.
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.
Thanks for the PR @comcalvi! This is a good first attempt, but there are some functional problems with the current code, and some design and organizational ones, before we can merge this in.
d8d5cd1
to
8034f84
Compare
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.
Looks great @comcalvi! I don't have any comments on the functionality, I only have some comments on the code details.
The most important thing I want to see before we merge this in is getting rid of the multiple calls to diff the Stacks. Ideally, we should perform a single diff, that includes the Nested Stacks, and use that for hotswapping. The same way we don't call diff multiple times for the cdk diff
command for Nested Stacks.
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.
Looks almost perfect! One last iteration, and we'll get this merged in.
@@ -60,16 +96,22 @@ export function stackSummaryOf(logicalId: string, resourceType: string, physical | |||
export class HotswapMockSdkProvider { | |||
public readonly mockSdkProvider: MockSdkProvider; | |||
|
|||
constructor() { | |||
constructor(rootStackName?: string, childStacks?: string[]) { |
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.
How about
constructor(rootStackName?: string, childStacks?: string[]) { | |
constructor(rootStackName?: string, childStacks: string[] = []) { |
? Will save you the null checks on childStacks
below.
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.
I think we don't actually need childStacks
at all, I've reworked this to be better.
@@ -454,7 +454,7 @@ test("will not perform a hotswap deployment if it doesn't know how to handle a s | |||
template: { | |||
Resources: { | |||
Bucket: { | |||
Type: 'AWS::Lambda::Function', | |||
Type: 'AWS::S3::Bucket', |
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 catch 😉
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.
Looks great @comcalvi!
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Resources in nested stacks can now be hotswapped.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license