forked from dxctechnology/dxcf-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommon-GroupSubscriptions.yaml
99 lines (99 loc) · 3.92 KB
/
Common-GroupSubscriptions.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
AWSTemplateFormatVersion: 2010-09-09
Description: Common-GroupSubscriptions Template.
This creates Standard Subscriptions to Group SNS Topics.
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Stack Dependencies
Parameters:
- GroupTopicsStackName
- Label:
default: Subscription Configuration
Parameters:
- AdministratorsTopicEmailEndpoint
- ManagersTopicEmailEndpoint
- DevelopersTopicEmailEndpoint
- UsersTopicEmailEndpoint
ParameterLabels:
GroupTopicsStackName:
default: Group Topics Stack Name
AdministratorsTopicEmailEndpoint:
default: Administrators Topic Email Endpoint
ManagersTopicEmailEndpoint:
default: Managers Topic Email Endpoint
DevelopersTopicEmailEndpoint:
default: Developers Topic Email Endpoint
UsersTopicEmailEndpoint:
default: Users Topic Email Endpoint
Parameters:
GroupTopicsStackName:
Description: Name of the CloudFormation Stack containing Group Topics
Type: String
MinLength: 2
MaxLength: 64
Default: GroupTopics
AllowedPattern: ^[A-Z][-a-zA-Z0-9]*$
ConstraintDescription: must begin with an upper case letter and contain alphanumeric characters and dashes.
AdministratorsTopicEmailEndpoint:
Description: Email Endpoint for Administrators Topic. If blank, no standard subscription will be created
Type: String
Default: ''
AllowedPattern: (^$|[^\s@]+@[^\s@]+\.[^\s@]+$)
ConstraintDescription: must be a valid email address.
ManagersTopicEmailEndpoint:
Description: Email Endpoint for Managers Topic. If blank, no standard subscription will be created
Type: String
Default: ''
AllowedPattern: (^$|[^\s@]+@[^\s@]+\.[^\s@]+$)
ConstraintDescription: must be a valid email address.
DevelopersTopicEmailEndpoint:
Description: Email Endpoint for Developers Topic. If blank, no standard subscription will be created
Type: String
Default: ''
AllowedPattern: (^$|[^\s@]+@[^\s@]+\.[^\s@]+$)
ConstraintDescription: must be a valid email address.
UsersTopicEmailEndpoint:
Description: Email Endpoint for Users Topic. If blank, no standard subscription will be created
Type: String
Default: ''
AllowedPattern: (^$|[^\s@]+@[^\s@]+\.[^\s@]+$)
ConstraintDescription: must be a valid email address.
Conditions:
ConfigureAdministratorsTopicSubscription: !Not [ !Equals [ !Ref AdministratorsTopicEmailEndpoint, '' ]]
ConfigureManagersTopicSubscription: !Not [ !Equals [ !Ref ManagersTopicEmailEndpoint, '' ]]
ConfigureDevelopersTopicSubscription: !Not [ !Equals [ !Ref DevelopersTopicEmailEndpoint, '' ]]
ConfigureUsersTopicSubscription: !Not [ !Equals [ !Ref UsersTopicEmailEndpoint, '' ]]
Resources:
AdministratorsTopicEmailSubscription:
Type: AWS::SNS::Subscription
Properties:
TopicArn: !ImportValue
Fn::Sub: ${GroupTopicsStackName}-AdministratorsTopic
Protocol: email
Endpoint: !Ref AdministratorsTopicEmailEndpoint
Condition: ConfigureAdministratorsTopicSubscription
ManagersTopicEmailSubscription:
Type: AWS::SNS::Subscription
Properties:
TopicArn: !ImportValue
Fn::Sub: ${GroupTopicsStackName}-ManagersTopic
Protocol: email
Endpoint: !Ref ManagersTopicEmailEndpoint
Condition: ConfigureManagersTopicSubscription
DevelopersTopicEmailSubscription:
Type: AWS::SNS::Subscription
Properties:
TopicArn: !ImportValue
Fn::Sub: ${GroupTopicsStackName}-DevelopersTopic
Protocol: email
Endpoint: !Ref DevelopersTopicEmailEndpoint
Condition: ConfigureDevelopersTopicSubscription
UsersTopicEmailSubscription:
Type: AWS::SNS::Subscription
Properties:
TopicArn: !ImportValue
Fn::Sub: ${GroupTopicsStackName}-UsersTopic
Protocol: email
Endpoint: !Ref UsersTopicEmailEndpoint
Condition: ConfigureUsersTopicSubscription