Skip to content

MI-317: Truncate and warn when prefixed resource names exceed AWS limits#1661

Merged
toddhainsworth merged 1 commit intomainfrom
fix/MI-317_resource-prefix-length
Apr 24, 2026
Merged

MI-317: Truncate and warn when prefixed resource names exceed AWS limits#1661
toddhainsworth merged 1 commit intomainfrom
fix/MI-317_resource-prefix-length

Conversation

@toddhainsworth
Copy link
Copy Markdown
Member

Description of the proposed changes

  • Replaces the synthesis error thrown when a prefixed resource name exceeds the AWS maximum length with automatic truncation — the aspect now truncates the name and appends an 8-character SHA-256 hash to maintain uniqueness
  • Emits a cdk synth warning (via Annotations.of(node).addWarning()) for each truncated resource, identifying the original and truncated name so users can shorten their prefix or base name if desired
  • Adds a truncateToFit private method that handles suffix-aware truncation (preserving .fifo for FIFO queues/topics); validateResourceName now only handles S3 structural checks (uppercase, underscores)
  • Adds four new tests covering: warning emission, deterministic output, FIFO suffix preservation, and no-truncation for short names
  • Documents the truncation behaviour and ResourcePrefixAspect usage in the package README

Notes to reviewers

🛈 When you've finished leaving feedback, please add a final comment to the PR tagging the author, letting them know that you have finished leaving feedback

@toddhainsworth toddhainsworth force-pushed the fix/MI-317_resource-prefix-length branch from 590471c to 25cf7c9 Compare April 23, 2026 23:11
@toddhainsworth toddhainsworth marked this pull request as ready for review April 23, 2026 23:11
@toddhainsworth toddhainsworth requested a review from a team as a code owner April 23, 2026 23:11
Copy link
Copy Markdown
Contributor

@crispy101 crispy101 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@kai-nguyen-aligent kai-nguyen-aligent left a comment

Choose a reason for hiding this comment

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

Nice one, @toddhainsworth 🚀

@toddhainsworth toddhainsworth merged commit 8b92e08 into main Apr 24, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants