Skip to content

Conversation

jdebuseamazon
Copy link
Contributor

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 suppressTemplateIndentation parameter, based on the Stack suppressTemplateIndentation was added to NestedStackProps. The new parameter was added to the call to the superclass constructor within the NestedStack constructor:

  constructor(scope: Construct, id: string, props: NestedStackProps = { }) {
    const parentStack = findParentStack(scope);

    super(scope, id, {
      env: { account: parentStack.account, region: parentStack.region },
      synthesizer: new NestedStackSynthesizer(parentStack.synthesizer),
      description: props.description,
      crossRegionReferences: parentStack._crossRegionReferences,
      suppressTemplateIndentation: props.suppressTemplateIndentation,
    });

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

@jdebuseamazon jdebuseamazon requested a review from a team as a code owner July 31, 2025 15:52
@aws-cdk-automation aws-cdk-automation requested a review from a team July 31, 2025 15:52
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Jul 31, 2025
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 9437b00
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core: Nested Stack templates cannot be suppressed natively by the CDK
2 participants