fix: "duplicate Export names" error deploying nested stacks with Fn::Join exports#1307
Merged
aws-cdk-automation merged 5 commits intomainfrom Apr 3, 2026
Conversation
…oin exports\n\nWhen IncludeNestedStacks is true, CloudFormation collapses all Fn::Join\nexport names to {{IntrinsicFunction://Fn::Join}}, causing a false\nduplicate export name error when multiple nested stacks have Fn::Join\nexports with runtime references.
…eation\n\nCloudFormation cannot resolve intrinsic functions (like Fn::Join) in\nexport names at validation time when IncludeNestedStacks is true. It\ncollapses all such exports to the same placeholder, causing a false\n\"duplicate Export names\" error.\n\nReverts the IncludeNestedStacks addition from the deploy changeset path.\nThe diff changeset path retains it since --method=auto already falls\nback to template-based diff on error.
Contributor
Author
|
Internal reference: D423570178 |
…stedStacks in deploy path" This reverts commit 7409264.
…tedStacks The --force deploy assertion expected CloudFormation to report "no changes" for nested stacks, which only works with IncludeNestedStacks. Without it, CloudFormation always executes the changeset for nested stacks. Update the assertion to expect a new changeset instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CDK CLI v2.1116.0 added
IncludeNestedStacks: trueto the deploy changeset creation path (PR #1292). This tells CloudFormation to validate all nested stack templates together when creating a changeset.However, CloudFormation cannot resolve intrinsic functions at changeset validation time. When multiple nested stacks use
Fn::Join(or similar intrinsics) to build export names with runtime references, CloudFormation collapses all of them to the same placeholder{{IntrinsicFunction://Fn::Join}}and reports a false "duplicate Export names" error. This affects patterns like the Amplify GraphQL API construct which usesFn::Joinwith an API ID to generate unique export names across nested stacks.This PR removes
IncludeNestedStacksfrom the deploy changeset path, reverting to the pre-v2.1116.0 behavior. The diff changeset path (cdk diff --method=change-set) retainsIncludeNestedStackssince--method=auto(the default) already falls back to template-based diff on error, and changeset diff didn't work for any nested stacks in previous versions so the current behavior is strictly an improvement.Internal reference D423570178
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license