in source/aws-bootstrap-kit/lib/account-provider.ts [53:100]
private constructor(scope: Construct, id: string) {
super(scope, id);
const code = lambda.Code.fromAsset(path.join(__dirname, 'account-handler'));
// Issues UpdateTable API calls
this.onEventHandler = new lambda.Function(this, 'OnEventHandler', {
code,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.onEventHandler',
timeout: Duration.minutes(5),
});
this.onEventHandler.addToRolePolicy(
new iam.PolicyStatement({
actions: [
'organizations:CreateAccount',
'organizations:TagResource'
],
resources: ['*'],
}),
);
// Checks if account is ready
this.isCompleteHandler = new lambda.Function(this, 'IsCompleteHandler', {
code,
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.isCompleteHandler',
timeout: Duration.seconds(30),
});
this.isCompleteHandler.addToRolePolicy(
new iam.PolicyStatement({
actions: [
'organizations:CreateAccount',
'organizations:DescribeCreateAccountStatus',
'organizations:TagResource'
],
resources: ['*'],
}),
);
this.provider = new cr.Provider(this, 'AccountProvider', {
onEventHandler: this.onEventHandler,
isCompleteHandler: this.isCompleteHandler,
queryInterval: Duration.seconds(10),
});
}