-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
73 lines (69 loc) · 2.43 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: git2params
package:
artifact: package/app.zip
custom:
####### Stages declaraion
prod: ${file(./prod-config.yml)
testing: ${file(./testing-config.yml)}
######### End of stages declaraion
param_prefix: /${self:custom.${opt:stage}.git_repo.name}
system_param_prefix: /${self:service}/${self:custom.${opt:stage}.git_repo.name}
sns_topic_arn: arn:aws:sns:${self:custom.${opt:stage}.aws.region}:${self:custom.${opt:stage}.aws.account_id}:${self:custom.${opt:stage}.aws.sns_topic}
provider:
name: aws
runtime: python2.7
region: ${self:custom.${opt:stage}.aws.region}
memorySize: 128
timeout: 300
logRetentionInDays: ${self:custom.${opt:stage}.log_retention_days}
stage: ${opt:stage}
environment:
GIT_REPO: ${self:custom.${opt:stage}.git_repo.url}
REGION: ${self:custom.${opt:stage}.aws.region}
SYSTEM_PARAM_PREFIX: ${self:custom.system_param_prefix}
PARAM_PREFIX: ${self:custom.param_prefix}
SNS_TOPIC_ARN: ${self:custom.sns_topic_arn}
DRYRUN: ${self:custom.${opt:stage}.dry_run}
iamRoleStatements:
- Effect: Allow
Action:
- ssm:DescribeParameters
Resource: "*"
- Effect: Allow
Action:
- ssm:PutParameter
- ssm:DeleteParameters
Resource: "arn:aws:ssm:${self:custom.${opt:stage}.aws.region}:${self:custom.${opt:stage}.aws.account_id}:parameter${self:custom.param_prefix}/**"
- Effect: Allow
Action:
- ssm:GetParameter
Resource: "arn:aws:ssm:${self:custom.${opt:stage}.aws.region}:${self:custom.${opt:stage}.aws.account_id}:parameter${self:custom.system_param_prefix}/*"
- Effect: Allow
Action:
- ssm:PutParameter
Resource: "arn:aws:ssm:${self:custom.${opt:stage}.aws.region}:${self:custom.${opt:stage}.aws.account_id}:parameter${self:custom.system_param_prefix}/revision"
- Effect: "Allow"
Action:
- "sns:Publish"
Resource: "${self:custom.sns_topic_arn}"
functions:
main:
handler: handler.lambda_handler
events:
- http:
path: params/update
method: post
resources:
Resources:
MainLogGroup:
Properties:
RetentionInDays: "7"
Outputs:
EnvVariables:
Value: |
GIT_REPO=${self:custom.${opt:stage}.git_repo.url}
REGION=${self:custom.${opt:stage}.aws.region}
SYSTEM_PARAM_PREFIX=${self:custom.system_param_prefix}
PARAM_PREFIX=${self:custom.param_prefix}
SNS_TOPIC_ARN=${self:custom.sns_topic_arn}
DRYRUN=${self:custom.${opt:stage}.dry_run}