Skip to content
This repository was archived by the owner on Nov 7, 2019. It is now read-only.

Commit 030a0cb

Browse files
Adding Support for SNS Subscriptions
**Why:** * Allows you to take a SNS topic and subscribe to any standrad protocol with custom hoosk for SQS **This change addresses the need by:** * closes #36 Signed-off-by: Christopher Hein <[email protected]>
1 parent 1bfa2b8 commit 030a0cb

23 files changed

+525
-90
lines changed

cloudformation/ecrrepository.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: 2010-09-09
2-
Description: 'AWS Service Broker - Amazon SNS (qs-1nt0fs93c)'
2+
Description: 'AWS Operator - Amazon ECR Repository'
33
Parameters:
44
Namespace:
55
Description: >-

cloudformation/snssubscription.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Description: 'AWS Operator - Amazon SNS Subscription'
3+
Parameters:
4+
Namespace:
5+
Description: >-
6+
This is the namespace for the Kubernetes object.
7+
Type: String
8+
ResourceVersion:
9+
Type: String
10+
Description: >-
11+
This is the resource version for the Kubernetes object.
12+
ResourceName:
13+
Description: >-
14+
This is the resource name for the Kubernetes object
15+
Type: String
16+
ClusterName:
17+
Description: >-
18+
This is the cluster name for the operator
19+
Type: String
20+
TopicARN:
21+
Type: String
22+
Description: >-
23+
What is the Amazon SNS Topic ARN to subscribe to?
24+
Protocol:
25+
Type: String
26+
Description: >-
27+
What is the protocol for the endpoint?
28+
Endpoint:
29+
Type: String
30+
Description: >-
31+
What is the endpoint address?
32+
QueueURL:
33+
Type: String
34+
Description: >-
35+
What is the SQS Queue URL?
36+
37+
Conditions:
38+
UseSQS: !Equals [!Ref Protocol, "sqs"]
39+
40+
Resources:
41+
SNSSubscription:
42+
Type: 'AWS::SNS::Subscription'
43+
Properties:
44+
Endpoint: !Ref Endpoint
45+
Protocol: !Ref Protocol
46+
TopicArn: !Ref TopicARN
47+
Region: !Ref "AWS::Region"
48+
49+
SQSQueuePolicy:
50+
Type: 'AWS::SQS::QueuePolicy'
51+
Condition: UseSQS
52+
Properties:
53+
PolicyDocument:
54+
Id: AWSOperatorQueuePolicy
55+
Version: '2012-10-17'
56+
Statement:
57+
- Sid: AllowSendReceive
58+
Effect: Allow
59+
Principal: "*"
60+
Action:
61+
- SQS:SendMessage
62+
Resource: !Ref Endpoint
63+
Condition:
64+
ArnEquals:
65+
"aws:SourceArn": !Ref TopicARN
66+
Queues:
67+
- !Ref QueueURL
68+
69+
Outputs:
70+
SubscriptionARN:
71+
Value: !Ref SNSSubscription
72+
Description: Subscription ARN

cloudformation/snstopic.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: 2010-09-09
2-
Description: 'AWS Service Broker - Amazon SNS (qs-1nt0fs93c)'
2+
Description: 'AWS Operator - Amazon SNS Topic'
33
Parameters:
44
Namespace:
55
Description: >-
@@ -17,15 +17,11 @@ Parameters:
1717
Description: >-
1818
This is the cluster name for the operator
1919
Type: String
20-
DisplayName:
21-
Type: String
22-
Description: >-
23-
What should the SNS Topics name display as.
2420
Resources:
2521
SNSTopic:
2622
Type: 'AWS::SNS::Topic'
2723

2824
Outputs:
29-
TopicName:
25+
TopicARN:
3026
Value: !Ref SNSTopic
3127
Description: Name of the topic

cloudformation/sqsqueue.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AWSTemplateFormatVersion: 2010-09-09
2-
Description: "AWS Servicebroker - Amazon SQS (qs-1nt0fs93h)"
2+
Description: "AWS Operator - Amazon SQS Queue"
33
Parameters:
44
Namespace:
55
Type: String

examples/cloudformationtemplates/dynamodb.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,4 @@ data:
9898
TableArn:
9999
Description: Arn of the DynamoDB Table
100100
Value: !GetAtt DynamoDBTable.Arn
101+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: CloudFormationTemplate
3+
metadata:
4+
name: ecrrepository
5+
data:
6+
key: ecrrepository.yaml
7+
template: |
8+
AWSTemplateFormatVersion: 2010-09-09
9+
Description: 'AWS Operator - Amazon ECR Repository'
10+
Parameters:
11+
Namespace:
12+
Description: >-
13+
This is the namespace for the Kubernetes object.
14+
Type: String
15+
ResourceVersion:
16+
Type: String
17+
Description: >-
18+
This is the resource version for the Kubernetes object.
19+
ResourceName:
20+
Description: >-
21+
This is the resource name for the Kubernetes object
22+
Type: String
23+
ClusterName:
24+
Description: >-
25+
This is the cluster name for the operator
26+
Type: String
27+
RepositoryName:
28+
Type: String
29+
Description: >-
30+
What should the ECR Repository be named
31+
Resources:
32+
ECRRepository:
33+
Type: AWS::ECR::Repository
34+
Properties:
35+
RepositoryName: !Ref RepositoryName
36+
37+
Outputs:
38+
RepositoryName:
39+
Value: !Ref ECRRepository
40+
Description: Name of the topic
41+
RepositoryARN:
42+
Value: !GetAtt ECRRepository.Arn
43+
Description: ARN of the Repository
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: CloudFormationTemplate
3+
metadata:
4+
name: snssubscription
5+
data:
6+
key: snssubscription.yaml
7+
template: |
8+
AWSTemplateFormatVersion: 2010-09-09
9+
Description: 'AWS Operator - Amazon SNS Subscription'
10+
Parameters:
11+
Namespace:
12+
Description: >-
13+
This is the namespace for the Kubernetes object.
14+
Type: String
15+
ResourceVersion:
16+
Type: String
17+
Description: >-
18+
This is the resource version for the Kubernetes object.
19+
ResourceName:
20+
Description: >-
21+
This is the resource name for the Kubernetes object
22+
Type: String
23+
ClusterName:
24+
Description: >-
25+
This is the cluster name for the operator
26+
Type: String
27+
TopicARN:
28+
Type: String
29+
Description: >-
30+
What is the Amazon SNS Topic ARN to subscribe to?
31+
Protocol:
32+
Type: String
33+
Description: >-
34+
What is the protocol for the endpoint?
35+
Endpoint:
36+
Type: String
37+
Description: >-
38+
What is the endpoint address?
39+
QueueURL:
40+
Type: String
41+
Description: >-
42+
What is the SQS Queue URL?
43+
44+
Conditions:
45+
UseSQS: !Equals [!Ref Protocol, "sqs"]
46+
47+
Resources:
48+
SNSSubscription:
49+
Type: 'AWS::SNS::Subscription'
50+
Properties:
51+
Endpoint: !Ref Endpoint
52+
Protocol: !Ref Protocol
53+
TopicArn: !Ref TopicARN
54+
Region: !Ref "AWS::Region"
55+
56+
SQSQueuePolicy:
57+
Type: 'AWS::SQS::QueuePolicy'
58+
Condition: UseSQS
59+
Properties:
60+
PolicyDocument:
61+
Id: AWSOperatorQueuePolicy
62+
Version: '2012-10-17'
63+
Statement:
64+
- Sid: AllowSendReceive
65+
Effect: Allow
66+
Principal: "*"
67+
Action:
68+
- SQS:SendMessage
69+
Resource: !Ref Endpoint
70+
Condition:
71+
ArnEquals:
72+
"aws:SourceArn": !Ref TopicARN
73+
Queues:
74+
- !Ref QueueURL
75+
76+
Outputs:
77+
SubscriptionARN:
78+
Value: !Ref SNSSubscription
79+
Description: Subscription ARN
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apiVersion: operator.aws/v1alpha1
2+
kind: CloudFormationTemplate
3+
metadata:
4+
name: snstopic
5+
data:
6+
key: snstopic.yaml
7+
template: |
8+
AWSTemplateFormatVersion: 2010-09-09
9+
Description: 'AWS Operator - Amazon SNS Topic'
10+
Parameters:
11+
Namespace:
12+
Description: >-
13+
This is the namespace for the Kubernetes object.
14+
Type: String
15+
ResourceVersion:
16+
Type: String
17+
Description: >-
18+
This is the resource version for the Kubernetes object.
19+
ResourceName:
20+
Description: >-
21+
This is the resource name for the Kubernetes object
22+
Type: String
23+
ClusterName:
24+
Description: >-
25+
This is the cluster name for the operator
26+
Type: String
27+
Resources:
28+
SNSTopic:
29+
Type: 'AWS::SNS::Topic'
30+
31+
Outputs:
32+
TopicARN:
33+
Value: !Ref SNSTopic
34+
Description: Name of the topic

0 commit comments

Comments
 (0)