Skip to content

feat(s3-deployment): support \Fn::FindInMap in deploy-time values for Source.jsonData #34186

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arvchahal
Copy link

Issue #30369

Closes #30369

Reason for this change

In large APIs with custom response templates—such as structured code error mappings—it’s common to rely on CfnMapping to reduce template size and avoid CloudFormation’s 1MB limit. Repeating the same mapping multiple times causes CloudFormation to raise an error due to template size constraints.

By allowing Fn::FindInMap to be used in Source.jsonData, developers can define mappings once and reuse them across resources, optimizing template size and maintainability.

Description of changes

• Added support for Fn::FindInMap in deploy-time JSON data passed via
Source.jsonData(...).
• Extended the renderData() logic to recognize Fn::FindInMap as a valid
intrinsic.
• Added unit and integration tests to validate this support.

Describe any new or updated permissions being added

N/A – no new permissions are introduced in this change.

Description of how you validated changes

• Added unit tests covering:
• Valid use of Fn::FindInMap inside strings and as standalone values
• Marker resolution for mixed Fn::Join inputs
• Edge cases (e.g., invalid intrinsics, lazy resolution)
• Added an integration test that synthesizes a stack using Fn::FindInMap within Source.jsonData and confirms successful binding.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added 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 labels Apr 17, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team April 17, 2025 20:47
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Features must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

@arvchahal arvchahal changed the title feat(aws-s3-deployment): support \Fn::FindInMap in deploy-time values for Source.jsonData feat(s3-deployment): support \Fn::FindInMap in deploy-time values for Source.jsonData Apr 17, 2025
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: a0048fe
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@arvchahal
Copy link
Author

Clarification Request: We are unsure why this change fails integration tests despite having an integration test in our build which works

@aws-cdk-automation aws-cdk-automation added the pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run label Apr 18, 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/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-s3-deployment: Support CfnMapping (Fn::FindInMap) in deploy time values for Source.jsonData
2 participants