-
-
Save sihil/4ad8a1a50e72f39e076f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "Publish or be damned.", | |
"Parameters": { | |
"SubscriberPrincipals": { | |
"Type": "CommaDelimitedList", | |
"Description": "Account IDs to allow subscription from." | |
}, | |
"Stage": { | |
"Type": "String", | |
"Description": "Name of stage for topics to create" | |
} | |
}, | |
"Resources": { | |
"LiveSNSTopic": { | |
"Type": "AWS::SNS::Topic", | |
"Properties": { | |
"TopicName": { "Fn::Join": [ "", ["fc-live-content-", { "Ref" : "Stage" }]]} | |
} | |
}, | |
"DraftSNSTopic": { | |
"Type": "AWS::SNS::Topic", | |
"Properties": { | |
"TopicName": { "Fn::Join": [ "", ["fc-draft-content-", { "Ref" : "Stage" }]]} | |
} | |
}, | |
"SNSTopicPolicy": { | |
"Type": "AWS::SNS::TopicPolicy", | |
"Properties": { | |
"PolicyDocument": { | |
"Version": "2012-10-17", | |
"Id": "MyTopicSubscribePolicy", | |
"Statement": [ | |
{ | |
"Sid": "Allow-other-account-to-subscribe-to-live-topic", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": { "Ref" : "SubscriberPrincipals" } | |
}, | |
"Action": "sns:Subscribe", | |
"Resource": { | |
"Ref": "LiveSNSTopic" | |
} | |
}, | |
{ | |
"Sid": "Allow-other-account-to-subscribe-to-draft-topic", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": { "Ref" : "SubscriberPrincipals" } | |
}, | |
"Action": "sns:Subscribe", | |
"Resource": { | |
"Ref": "DraftSNSTopic" | |
} | |
} | |
] | |
}, | |
"Topics": [ | |
{ "Ref": "LiveSNSTopic" }, | |
{ "Ref": "DraftSNSTopic" } | |
] | |
} | |
} | |
}, | |
"Outputs": { | |
"LiveSNSTopicTopicARN": { | |
"Value": { | |
"Ref": "LiveSNSTopic" | |
} | |
}, | |
"DraftSNSTopicTopicARN": { | |
"Value": { | |
"Ref": "DraftSNSTopic" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment