-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserverless.ts
54 lines (50 loc) · 1.65 KB
/
serverless.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import type { AWS } from '@serverless/typescript';
import { DynamoDbTableNameOutputId } from '@resources/dynamodb';
import { AppEnv, esbuildConfig, region } from './config';
import { getOutputValue } from './configHelpers';
import { functions } from './functions';
import { cdkAppCloudFormationTemplate, resources } from './resources';
const serverlessConfiguration: AWS = {
service: `test-stack-orchestrator`, // Keep it short to have role name below 64
frameworkVersion: '>=2.50.0',
plugins: ['serverless-esbuild'],
provider: {
name: 'aws',
runtime: 'nodejs14.x',
architecture: 'arm64',
region,
profile: 'test-stack-orchestrator',
stage: `\${opt:stage, '${AppEnv.Dev}'}`, // Doc: https://www.serverless.com/framework/docs/providers/aws/guide/credentials/
lambdaHashingVersion: '20201221',
environment: {
AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',
NODE_OPTIONS: '--enable-source-maps --stack-trace-limit=1000',
TABLE_NAME: getOutputValue(cdkAppCloudFormationTemplate, DynamoDbTableNameOutputId),
},
eventBridge: {
useCloudFormation: true,
},
iamRoleStatements: [
{
Effect: 'Allow',
Resource: ['*'],
Action: [
'dynamodb:PutItem',
'dynamodb:Query',
'dynamodb:GetItem',
'dynamodb:UpdateItem',
'dynamodb:DeleteItem',
'dynamodb:BatchWriteItem',
],
},
],
},
package: { individually: true },
functions,
custom: {
esbuild: esbuildConfig,
},
// @ts-expect-error types are wrong https://github.com/serverless/typescript/issues/27
resources,
};
module.exports = serverlessConfiguration;