Skip to content
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

core: suppressTemplateIndentation option not supported in NestedStackProps #28836

Closed
1 of 2 tasks
Laxenade opened this issue Jan 24, 2024 · 3 comments
Closed
1 of 2 tasks
Labels
@aws-cdk/core Related to core CDK functionality feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.

Comments

@Laxenade
Copy link

Laxenade commented Jan 24, 2024

Describe the feature

I'm working on creating a nested stack with a template that is larger than 1MB (it's currently at 3.1MB). After reviewing #25892, it appears that efforts have been made to reduce the size of the main stack's template. It would be beneficial to have a similar feature for nested stacks.

Use Case

The rationale for implementing this feature is essentially the same as the reasons for minifying the main stack's template. This also helps keep the experience consistent between Stack and NestedStack.

Proposed Solution

The required code change appears to be fairly straightforward, closely resembling the changes made in the original pull request.

Place to change:

const cfn = JSON.stringify(this._toCloudFormation());

Relevant changes from previous PR:

const indent = this._suppressTemplateIndentation ? undefined : 1;

The same context key can be re-used and the new option is NestedStackProps can have the same name as the one in StackProps: suppressTemplateIndentation

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.96.1

Environment details (OS name and version, etc.)

MacOS 13.6.3

@Laxenade Laxenade added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 24, 2024
@github-actions github-actions bot added the @aws-cdk/core Related to core CDK functionality label Jan 24, 2024
@Laxenade
Copy link
Author

Looking into the issue further, it's weird to me that the code in NestedStack already omits the spaces, since no parameter was given to stringify. Yet, the generated template of my nested stacks is still indented by 1 space.

const cfn = JSON.stringify(this._toCloudFormation());

Sample generated nested stack template:

{
 "Resources": {
  "<some logical id>": {
   "Type": "AWS::CloudWatch::Dashboard",
   "Properties": {
    "DashboardBody": {
     "Fn::Join": [
      "",
      [
       "{\"start\":\"-PT3H\",\"periodOverride\":\"inherit\",\"widgets\":[{\"type\":\"text\",\"width\":24,\"height\":3,\"x\":0,\"y\":0,\"properties\":{\"markdown\":\"| Environment| AWS Account| AWS Console| Pipeline\\n|---|---|---|---\\n

@Laxenade
Copy link
Author

Nvm, I re-built my CDK from scratch, the nested stacks did respect suppressTemplateIndentation. Closing.

@Laxenade Laxenade closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2024
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant