feat(core): allow indentation suppression in nested stacks#35122
Conversation
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Why is this PR still sitting here without review? |
|
I’m sorry to bother you, but I’d like to ask for a review on this PR. This change addresses the nested stack template size issue discussed in #32798 by allowing I understand this PR has been inactive for a while.
Any guidance on the preferred next step (or the right reviewers) would be greatly appreciated. |
go-to-k
left a comment
There was a problem hiding this comment.
Thanks for this PR. Left a minor comment.
There was a problem hiding this comment.
This test doesn't need to be a reference test for nested stacks.
Also, suppressTemplateIndentation property does not appear on the CFn template, so it would be better to check in assertions whether template indentation is suppressed.
It should be able to be simplified as follows. (In that case, the filename would be changed too.)
For example:
const app = new cdk.App();
const stack = new cdk.Stack(app, 'ParentStack');
const nested = new cdk.NestedStack(stack, 'NestedSuppressIndentation', { suppressTemplateIndentation: true });
new s3.Bucket(nested, 'Bucket'); // dummy
const testCase = new integ.IntegTest(app, 'NestedSuppressIndentationTest', {
testCases: [stack],
});
const nestedChild = nested.node.defaultChild as cdk.CfnStack;
const nestedTemplateUrl = nestedChild.templateUrl!; // Nested stacks must have the templateUrl
const apiCall = testCase.assertions.awsApiCall('S3', 'getObject', {
Bucket: cdk.Fn.select(3, cdk.Fn.split('/', nestedTemplateUrl)),
Key: cdk.Fn.select(4, cdk.Fn.split('/', nestedTemplateUrl)),
});
apiCall.expect(integ.ExpectedResult.objectLike({ Body: '{"Resources":{"Bucket83908E77":{"Type":"AWS::S3::Bucket","UpdateReplacePolicy":"Retain","DeletionPolicy":"Retain"}}}' }));There was a problem hiding this comment.
Thanks for the comment, I've updated the test per your suggestions
|
|
||||||||||||||
|
|
||||||||||||||
go-to-k
left a comment
There was a problem hiding this comment.
Thanks for the change! LGTM.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status🚫 The pull request has left the queue (rule: This pull request spent 5 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
Pull request has been modified.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status✅ The pull request has been merged at d1d5bae This pull request spent 5 seconds in the queue, with no time running CI. Required conditions to merge
|
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #32798
Reason for this change
Stacks can be created with an optional suppressTemplateIndentation parameter to determine whether indentation is suppressed. This may for example be useful to keep stack sizes within AWS CloudFormation quotas. However, indentation suppression is currently not supported for nested stacks.
Description of changes
A new
suppressTemplateIndentationparameter, based on the Stack suppressTemplateIndentation was added to NestedStackProps. The new parameter was added to the call to the superclass constructor within theNestedStackconstructor:Description of how you validated changes
Unit tests and an integration test. The integration test was based on the existing integ.nested-stack-references.ts.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license