This repository has been archived by the owner on Oct 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoutput.yaml
84 lines (84 loc) · 2.07 KB
/
output.yaml
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
77
78
79
80
81
82
83
84
Transform: AWS::Serverless-2016-10-31
Parameters:
EventBusName:
Type: String
Default: StripeEventBus
Description: (Required) Name of EventBus.
StripeWebhookSecret:
Type: String
Default: wshec_1234
Description: (Required) Your Stripe webhooks secret
StripeSecretKey:
Type: String
Default: sk_12345
Description: (Required) Your Stripe secret key
Resources:
EventReciever:
Type: AWS::Serverless::Function
Properties:
Runtime: nodejs12.x
Handler: send-to-event-bus.handler
CodeUri: s3://stripe-event-bus/6a9736d71e71dc6010da4c9c33824f2c
Environment:
Variables:
EVENT_BUS_NAME:
Ref: EventBusName
STRIPE_WEBHOOK_SECRET:
Ref: StripeWebhookSecret
STRIPE_SECRET_KEY:
Ref: StripeSecretKey
Policies:
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- events:PutEvents
Resource: '*'
Events:
WebhookEndpoint:
Type: Api
Properties:
Path: /webhook
Method: POST
EventBus:
Type: AWS::Events::EventBus
Properties:
Name: StripeEventBus
EventProcessor:
Type: AWS::Serverless::Function
Properties:
Runtime: nodejs12.x
Handler: event-processor.handler
CodeUri: s3://stripe-event-bus/6a9736d71e71dc6010da4c9c33824f2c
EventListener:
Type: AWS::Events::Rule
Properties:
Description: Handles Stripe events
EventBusName:
Fn::GetAtt:
- EventBus
- Name
EventPattern:
source:
- Stripe
detail-type:
- payment_intent.succeeded
Targets:
- Id: something
Arn:
Fn::GetAtt:
- EventProcessor
- Arn
EventProcessorPermission:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- EventProcessor
- Arn
Principal: events.amazonaws.com
SourceArn:
Fn::GetAtt:
- EventListener
- Arn