-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserverless.yml
76 lines (71 loc) · 1.74 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
74
75
76
service:
name: codepipeline-datadog-events
# Add the serverless-webpack plugin
plugins:
- serverless-webpack
provider:
name: aws
runtime: nodejs12.x
memorySize: 128
timeout: 10
logRetentionInDays: 7
versionFunctions: false
environment:
DD_API_KEY: ${ssm:/datadog/DD_API_KEY~true}
SLACK_WEBHOOK_URL: ${ssm:/slack/SLACK_WEBHOOK_URL~true}
variableSyntax: "\\$\\{(?!AWS)([ \":~a-zA-Z0-9._,\\-\\/\\(\\)]+?)}"
iamRoleStatements:
- Effect: "Allow"
Action:
- "sqs:SendMessage"
- "sqs:GetQueueUrl"
Resource:
Fn::GetAtt:
- EventQueue
- Arn
- Effect: "Allow"
Action:
- "sqs:ListQueues"
Resource: !Sub "arn:aws:${AWS::AccountId}:....."
- Effect: "Allow"
Action:
- "cloudwatch:PutMetricData"
- "codepipeline:List*"
- "codepipeline:Get*"
- "ec2:DescribeRegions"
Resource: "*"
functions:
main:
handler: handler.main
events:
- sqs:
arn:
Fn::GetAtt:
- EventQueue
- Arn
cloudwatch:
handler: handler.scheduledMetrics
events:
- schedule: rate(1 minute)
resources:
Resources:
EventQueue:
Type: AWS::SQS::Queue
QueuePolicy:
Type: AWS::SQS::QueuePolicy
Properties:
PolicyDocument:
Version: "2012-10-17"
Id: "QueuePolicy1"
Statement:
- Effect: "Allow"
Action: "sqs:SendMessage"
Action:
- "sqs:SendMessage"
Resource: "*"
Principal: "*"
Condition:
ArnLike:
"AWS:SourceArn": !Sub "arn:aws:sns:*:${AWS::AccountId}:*"
Queues:
- !Ref EventQueue