-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstack.yml
81 lines (75 loc) · 2.29 KB
/
stack.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
77
78
79
AWSTemplateFormatVersion: '2010-09-09'
Description: Robonews Root Stack
Parameters:
BucketName:
Type: String
Description: Name of the Robonews bucket
SenderLambdaName:
Type: String
Description: Name of the sender lambda
SenderLambdaImageUri:
Type: String
Description: Uri of the sender lambda image
SenderTemplateUrl:
Type: String
Description: Url of the sender stack template
ConfirmLambdaName:
Type: String
Description: Name of the confirmation lambda
SubscribeLambdaName:
Type: String
Description: Name of the subscribe lambda
UnsubscribeLambdaName:
Type: String
Description: Name of the unsubscribe lambda
SubscriptionTemplateUrl:
Type: String
Description: Url of the subscription template
Tag:
Type: String
Description: Randomly generated unique tag
MailgunApiKey:
Type: String
Description: API key for mailgun email service
Resources:
SymmetricKey:
Type: AWS::KMS::Key
Properties:
Description: Symmetric encryption key for Robonews app
KeyPolicy:
Version: '2012-10-17'
Statement:
- Sid: AllowRootAccountAdministration
Effect: Allow
Principal:
AWS: !Sub arn:aws:iam::${AWS::AccountId}:root
Action:
- 'kms:*'
Resource: '*'
- Sid: AllowAllKeyAccess
Effect: Allow
Principal: '*'
Action: 'kms:*'
Resource: '*'
SubscriptionStack:
Type: "AWS::CloudFormation::Stack"
Properties:
TemplateURL: !Sub "http://s3.amazonaws.com/${SubscriptionTemplateUrl}"
Parameters:
BucketName: !Ref BucketName
ConfirmLambdaName: !Ref ConfirmLambdaName
SubscribeLambdaName: !Ref SubscribeLambdaName
UnsubscribeLambdaName: !Ref UnsubscribeLambdaName
EncryptionKeyId: !Ref SymmetricKey
Tag: !Ref Tag
MailgunApiKey: !Ref MailgunApiKey
SenderStack:
Type: "AWS::CloudFormation::Stack"
DependsOn: SubscriptionStack
Properties:
TemplateURL: !Sub "http://s3.amazonaws.com/${SenderTemplateUrl}"
Parameters:
LambdaFunctionName: !Ref SenderLambdaName
ImageUri: !Ref SenderLambdaImageUri
EncryptionKeyId: !Ref SymmetricKey
MailgunApiKey: !Ref MailgunApiKey