-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathsubscriptions.yaml
More file actions
89 lines (82 loc) · 2.98 KB
/
Copy pathsubscriptions.yaml
File metadata and controls
89 lines (82 loc) · 2.98 KB
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
85
86
87
88
89
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
AWSTemplateFormatVersion: "2010-09-09"
Description: Defines the rule for the events (subscriptions) that Unicorn Properties wants to consume.
Parameters:
Stage:
Type: String
Default: local
AllowedValues:
- local
- dev
- prod
Resources:
#### UNICORN CONTRACTS EVENT SUBSCRIPTIONS
ContractStatusChangedSubscriptionRule:
Type: AWS::Events::Rule
Properties:
Name: unicorn.properties-ContractStatusChanged
Description: Contract Status Changed subscription
EventBusName:
Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornContractsEventBusArn}}"
EventPattern:
source:
- "{{resolve:ssm:/uni-prop/UnicornContractsNamespace}}"
detail-type:
- ContractStatusChanged
State: ENABLED
Targets:
- Id: SendEventTo
Arn:
Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}"
RoleArn:
Fn::GetAtt: [ UnicornPropertiesSubscriptionRole, Arn ]
#### UNICORN WEB EVENT SUBSCRIPTIONS
PublicationApprovalRequestedSubscriptionRule:
Type: AWS::Events::Rule
Properties:
Name: unicorn.properties-PublicationApprovalRequested
Description: Publication evaluation completed subscription
EventBusName:
Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornWebEventBusArn}}"
EventPattern:
source:
- "{{resolve:ssm:/uni-prop/UnicornWebNamespace}}"
detail-type:
- PublicationApprovalRequested
State: ENABLED
Targets:
- Id: SendEventTo
Arn:
Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}"
RoleArn:
Fn::GetAtt: [ UnicornPropertiesSubscriptionRole, Arn ]
# This IAM role allows EventBridge to assume the permissions necessary to send events
# from the publishing event bus, to the subscribing event bus (UnicornPropertiesEventBusArn)
UnicornPropertiesSubscriptionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Action: sts:AssumeRole
Principal:
Service: events.amazonaws.com
Policies:
- PolicyName: PutEventsOnUnicornPropertiesEventBus
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action: events:PutEvents
Resource:
Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}"
Outputs:
ContractStatusChangedSubscription:
Description: Rule ARN for Contract service event subscription
Value:
Fn::GetAtt: [ ContractStatusChangedSubscriptionRule, Arn ]
PublicationApprovalRequestedSubscription:
Description: Rule ARN for Web service event subscription
Value:
Fn::GetAtt: [ PublicationApprovalRequestedSubscriptionRule, Arn ]