Skip to content

Commit 44bc54e

Browse files
fix topic creation
1 parent 6a774e4 commit 44bc54e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

templates_cloudlogs/CloudLogs.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Parameters:
6262
TopicARN:
6363
Type: String
6464
Default: ""
65-
Description: "The ARN of an existing SNS Topic. Ignored if CreateTopic is set to true."
65+
Description: "The ARN of an existing SNS Topic. If CreateTopic is true, this will be used as the name of the new topic."
6666

6767
Endpoint:
6868
Type: String
@@ -112,21 +112,18 @@ Resources:
112112
Roles:
113113
- !Ref CloudLogsRole
114114

115-
# SNS Topic (optional creation)
116115
CloudTrailNotificationsTopic:
117116
Condition: CreateSNSTopic
118117
Type: "AWS::SNS::Topic"
119118
Properties:
120-
TopicName: !Sub "${AWS::StackName}-CloudTrailNotifications"
121-
DisplayName: "CloudTrail Notifications for Sysdig"
119+
TopicName: !Select [ 5, !Split [ ":", !Ref TopicARN ] ]
122120

123121
CloudTrailNotificationsSubscription:
124-
Condition: CreateSNSTopic
125122
Type: "AWS::SNS::Subscription"
126123
Properties:
127-
TopicArn: !Ref CloudTrailNotificationsTopic
124+
TopicArn: !If [ CreateSNSTopic, !Ref CloudTrailNotificationsTopic, !Ref TopicARN ]
128125
Protocol: "https"
129-
Endpoint: '${Endpoint}'
126+
Endpoint: !Ref Endpoint
130127

131128
CloudTrailNotificationsPolicy:
132129
Condition: CreateSNSTopic

0 commit comments

Comments
 (0)