Skip to content

Instantly share code, notes, and snippets.

@fogfish
Created March 9, 2021 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fogfish/2580fd40a24fe034ef22d6608a7f51d6 to your computer and use it in GitHub Desktop.
Save fogfish/2580fd40a24fe034ef22d6608a7f51d6 to your computer and use it in GitHub Desktop.
AWS CDK Bomb 💣
import * as cdk from '@aws-cdk/core'
class MyResource extends cdk.Construct {
constructor(scope: cdk.Construct, id: string, l: number) {
super(scope, id)
for (const x of Array(10).keys()) {
(l === 0)
? new cdk.CfnJson(this, `${id}${x}`, {value: '0123456789abcdef'})
: new MyResource(this, `${id}${x}`, l - 1)
}
}
}
class MyStack extends cdk.Stack {
constructor (scope: cdk.Construct) {
super(scope, 'Stack', {})
new MyResource(this, 'R', 10)
}
}
new MyStack(app)
@mbonig
Copy link

mbonig commented Mar 25, 2021

Not sure what the underlying issue is, but I find this interesting:

> for (const thing of Array(10).keys()) console.log(thing)
0
1
2
3
4
5
6
7
8
9
undefined
>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment