forked from aws-samples/aws-cfn-custom-resource-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cr-backend-substack-template.template
62 lines (62 loc) · 2.34 KB
/
cr-backend-substack-template.template
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
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Builds out a backend infrastructure for handling the messaging for CloudFormation Custom Resources.",
"Resources" : {
"CustomResourceQueue" : {
"Type": "AWS::SQS::Queue",
"Properties": {
"ReceiveMessageWaitTimeSeconds": "20",
"VisibilityTimeout": "30"
}
},
"CustomResourceTopic" : {
"Type" : "AWS::SNS::Topic",
"Properties" : {
"Subscription" : [
{ "Endpoint" : { "Fn::GetAtt" : [ "CustomResourceQueue", "Arn" ] }, "Protocol" : "sqs" }
]
}
},
"CustomResourceQueuePolicy" : {
"Type" : "AWS::SQS::QueuePolicy",
"Properties" : {
"PolicyDocument" : {
"Version": "2008-10-17",
"Id": { "Fn::Join" : [ "/", [ { "Fn::GetAtt" : [ "CustomResourceQueue", "Arn" ] }, "CustomResourceQueuePolicy" ] ] },
"Statement": [
{
"Sid": "AllowTopicToPublishMessages",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "SQS:SendMessage",
"Resource": { "Fn::GetAtt" : [ "CustomResourceQueue", "Arn" ] },
"Condition": {
"ArnEquals": {
"aws:SourceArn": { "Ref" : "CustomResourceTopic" }
}
}
}
]
},
"Queues" : [
{ "Ref" : "CustomResourceQueue" }
]
}
}
},
"Outputs" : {
"CustomResourceTopicARN" : {
"Value" : { "Ref" : "CustomResourceTopic" }
},
"CustomResourceQueueURL" : {
"Description" : "URL of newly created SQS Queue",
"Value" : { "Ref" : "CustomResourceQueue" }
},
"CustomResourceQueueARN" : {
"Description" : "ARN of newly created SQS Queue",
"Value" : { "Fn::GetAtt" : ["CustomResourceQueue", "Arn"]}
}
}
}