File tree 1 file changed +14
-1
lines changed
packages/@aws-cdk/core/lib
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -791,7 +791,8 @@ export class Stack extends CoreConstruct implements ITaggable {
791
791
const numberOfResources = Object . keys ( resources ) . length ;
792
792
793
793
if ( numberOfResources > this . maxResources ) {
794
- throw new Error ( `Number of resources in stack '${ this . node . path } ': ${ numberOfResources } is greater than allowed maximum of ${ this . maxResources } ` ) ;
794
+ const counts = Object . entries ( count ( Object . values ( resources ) . map ( ( r : any ) => `${ r ?. Type } ` ) ) ) . map ( ( [ type , c ] ) => `${ type } (${ c } )` ) . join ( ', ' ) ;
795
+ throw new Error ( `Number of resources in stack '${ this . node . path } ': ${ numberOfResources } is greater than allowed maximum of ${ this . maxResources } : ${ counts } ` ) ;
795
796
} else if ( numberOfResources >= ( this . maxResources * 0.8 ) ) {
796
797
Annotations . of ( this ) . addInfo ( `Number of resources: ${ numberOfResources } is approaching allowed maximum of ${ this . maxResources } ` ) ;
797
798
}
@@ -1357,6 +1358,18 @@ export interface ExportValueOptions {
1357
1358
readonly name ?: string ;
1358
1359
}
1359
1360
1361
+ function count ( xs : string [ ] ) : Record < string , number > {
1362
+ const ret : Record < string , number > = { } ;
1363
+ for ( const x of xs ) {
1364
+ if ( x in ret ) {
1365
+ ret [ x ] += 1 ;
1366
+ } else {
1367
+ ret [ x ] = 1 ;
1368
+ }
1369
+ }
1370
+ return ret ;
1371
+ }
1372
+
1360
1373
// These imports have to be at the end to prevent circular imports
1361
1374
import { CfnOutput } from './cfn-output' ;
1362
1375
import { addDependency } from './deps' ;
You can’t perform that action at this time.
0 commit comments