-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverless.yml
73 lines (69 loc) · 2.02 KB
/
serverless.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
service: mysql-init-custom-resource
useDotenv: true
provider:
name: aws
runtime: java11
memorySize: 1024
timeout: 60
region: us-west-2
deploymentBucket:
name: ${env:BUCKET}
serverSideEncryption: "AES256"
logRetentionInDays: 7
iam:
deploymentRole: "arn:aws:iam::${env:ACCOUNT}:role/cloudformation/deployer/cloudformation-deployer"
role:
statements:
- Effect: Allow
Action:
- secretsmanager:GetResourcePolicy
- secretsmanager:GetSecretValue
- secretsmanager:DescribeSecret
- secretsmanager:ListSecretVersionIds
- secretsmanager:ListSecret
Resource:
- "*"
stackTags:
Creator: serverless
Environment: ${opt:stage}
Project: ${self:service}
Team: platform
Visibility: internal
vpc:
subnetIds:
- ${env:SUBNET_ID}
securityGroupIds:
- !GetAtt LambdaSg.GroupId
lambdaHashingVersion: 20201221
functions:
InitMySqlDatabase:
handler: com.dwolla.mysql.init.MySqlDatabaseInitHandler
package:
artifact: ${env:DATABASE_ARTIFACT_PATH}
package:
individually: true
resources:
Resources:
LambdaSg:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Traffic source security group for ${opt:stage} mysql-init-lambda
VpcId:
Fn::ImportValue: ${opt:stage}VpcId
Tags:
- Key: SecurityGroupType
Value: TrafficSource
Description: "CloudFormation custom resources for initializing MySQL databases and users"
Outputs:
InitMySqlDatabaseFunction:
Description: Database initialization Lambda Function Service Token
Value:
'Fn::GetAtt': [InitMySqlDatabaseLambdaFunction, Arn]
Export:
Name: ${self:service}:${opt:stage}:InitMySqlDatabaseArn
InitMySqlDatabaseSg:
Description: Secrutiy group attached to database initialization Lambda Function
Value:
!GetAtt LambdaSg.GroupId
Export:
Name: ${self:service}:${opt:stage}:InitMySqlDatabaseSgId