fix(elasticache-alpha): deployment fails when serverlessCacheName or userGroupId is not specified#36459
Conversation
…userGroupId is not specified
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
|
||||||||||||||
|
|
||||||||||||||
|
Exemption Request: Existing unit tests already cover auto-generated names, and the integration test validates the 40-character limit in the generated snapshot. |
| this.engine = props.engine ?? CacheEngine.VALKEY_LATEST; | ||
| this.serverlessCacheName = props.serverlessCacheName ?? Lazy.string({ produce: () => Names.uniqueId(this) }); | ||
| this.serverlessCacheName = props.serverlessCacheName ?? Lazy.string({ | ||
| produce: () => Names.uniqueResourceName(this, { maxLength: 40 }), |
There was a problem hiding this comment.
Thanks for showing this very useful function(uniqueResourceName)!
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status✅ The pull request has been merged at aaf25cd This pull request spent 49 minutes 33 seconds in the queue, including 49 minutes 23 seconds running CI. Required conditions to merge
|
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #36458
Reason for this change
When deploying an ElastiCache
ServerlessCacheorUserGroupwithout explicitly specifying aserverlessCacheNameoruserGroupId, the auto-generated name can exceed AWS ElastiCache's 40-character limit, causing deployment failures.The current implementation uses
Names.uniqueId()which generates names without length constraints. With longer stack names or construct paths, the generated identifier exceeds the service's maximum allowed length.Description of changes
Replace the name generation logic with
Names.uniqueResourceName(this, { maxLength: 40 })to ensure generated names respect the AWS limit:Description of how you validated changes
Added integration test
integ.serverless-cache-auto-generate-name.tsthat creates aServerlessCacheandUserGroupwithout specifying names.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license