File tree Expand file tree Collapse file tree 1 file changed +2
-19
lines changed
packages/aws-cdk-lib/aws-synthetics/lib Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,8 @@ export class Group extends cdk.Resource implements IGroup {
125125
126126 constructor ( scope : Construct , id : string , props : GroupProps = { } ) {
127127 super ( scope , id , {
128- physicalName : props . groupName || cdk . Lazy . string ( {
129- produce : ( ) => this . generateUniqueName ( ) ,
128+ physicalName : props . groupName ?? cdk . Lazy . string ( {
129+ produce : ( ) => cdk . Names . uniqueResourceName ( this , { maxLength : 64 } ) ,
130130 } ) ,
131131 } ) ;
132132
@@ -175,21 +175,4 @@ export class Group extends cdk.Resource implements IGroup {
175175 public get canaries ( ) : ICanary [ ] {
176176 return Array . from ( this . _canaries ) ;
177177 }
178-
179- /**
180- * Generate a unique name for the group
181- */
182- private generateUniqueName ( ) : string {
183- const uniqueId = cdk . Names . uniqueId ( this ) ;
184- const maxLength = 64 ; // AWS limit for group names
185-
186- if ( uniqueId . length <= maxLength ) {
187- return uniqueId ;
188- }
189-
190- // Truncate and add hash to ensure uniqueness
191- const hash = cdk . Names . nodeUniqueId ( this . node ) . slice ( - 8 ) ;
192- const truncated = uniqueId . slice ( 0 , maxLength - 9 ) ; // Leave room for hash and separator
193- return `${ truncated } -${ hash } ` ;
194- }
195178}
You can’t perform that action at this time.
0 commit comments