1
1
AWSTemplateFormatVersion : " 2010-09-09"
2
2
Description : >
3
- CloudFormation organizational template for provisioning
4
- the necessary resources for the `cloud-logs`
5
- component and the read-only role required to itneract with
3
+ CloudFormation organizational template for provisioning the necessary resources
4
+ for the `cloud-logs` component and the read-only role required to interact with
6
5
the target organizational environment.
7
6
8
7
Metadata :
@@ -15,6 +14,9 @@ Metadata:
15
14
- ExternalID
16
15
- TrustedIdentity
17
16
- BucketARN
17
+ - CreateTopic
18
+ - TopicARN
19
+ - Endpoint
18
20
19
21
ParameterLabels :
20
22
NameSuffix :
@@ -25,6 +27,12 @@ Metadata:
25
27
default : Trusted Identity
26
28
BucketARN :
27
29
default : Bucket ARN
30
+ CreateTopic :
31
+ default : Create SNS Topic
32
+ TopicARN :
33
+ default : SNS Topic ARN
34
+ Endpoint :
35
+ default : Sysdig Secure endpoint
28
36
29
37
Parameters :
30
38
NameSuffix :
@@ -41,7 +49,20 @@ Parameters:
41
49
Description : The Role in Sysdig's AWS Account with permissions to your account
42
50
BucketARN :
43
51
Type : String
44
- Description : The ARN of your s3 bucket associated with your Cloudtrail trail logs.
52
+ Description : The ARN of your S3 bucket associated with your CloudTrail trail logs.
53
+ CreateTopic :
54
+ Type : String
55
+ AllowedValues :
56
+ - " true"
57
+ - " false"
58
+ Default : " false"
59
+ Description : Whether to create a new SNS Topic for CloudTrail notifications.
60
+ TopicARN :
61
+ Type : String
62
+ Description : The ARN of an existing SNS Topic. If CreateTopic is true, this will be used as the name of the new topic.
63
+ Endpoint :
64
+ Type : String
65
+ Description : Sysdig Secure endpoint to receive CloudTrail notifications.
45
66
46
67
Resources :
47
68
CloudLogsRole :
@@ -51,30 +72,60 @@ Resources:
51
72
AssumeRolePolicyDocument :
52
73
Version : " 2012-10-17"
53
74
Statement :
54
- - Effect : " Allow"
55
- Principal :
56
- AWS : !Ref TrustedIdentity
57
- Action :
58
- - " sts:AssumeRole"
59
- Condition :
60
- StringEquals :
61
- " sts:ExternalId " : !Ref ExternalID
62
- Policies :
63
- - PolicyName : !Sub sysdig-secure-cloudlogs-${NameSuffix}
64
- PolicyDocument :
65
- Version : " 2012-10-17"
66
- Statement :
67
- - Sid : " CloudlogsS3AccessGet"
68
- Effect : " Allow"
75
+ - Effect : " Allow"
76
+ Principal :
77
+ AWS : !Ref TrustedIdentity
69
78
Action :
70
- - " s3:Get*"
71
- Resource :
72
- - !Sub ' ${BucketARN}'
73
- - !Sub ' ${BucketARN}/*'
74
- - Sid : " CloudlogsS3AccessList"
79
+ - " sts:AssumeRole"
80
+ Condition :
81
+ StringEquals :
82
+ " sts:ExternalId " : !Ref ExternalID
83
+ Policies :
84
+ - PolicyName : !Sub sysdig-secure-cloudlogs-${NameSuffix}
85
+ PolicyDocument :
86
+ Version : " 2012-10-17"
87
+ Statement :
88
+ - Sid : " CloudlogsS3AccessGet"
89
+ Effect : " Allow"
90
+ Action :
91
+ - " s3:Get*"
92
+ Resource :
93
+ - !Sub ' ${BucketARN}'
94
+ - !Sub ' ${BucketARN}/*'
95
+
96
+ CloudTrailNotificationsTopic :
97
+ Condition : CreateSNSTopic
98
+ Type : " AWS::SNS::Topic"
99
+ Properties :
100
+ TopicName : !Select [ 5, !Split [ ":", !Ref TopicARN ] ]
101
+
102
+ CloudTrailNotificationsSubscription :
103
+ Type : " AWS::SNS::Subscription"
104
+ Properties :
105
+ TopicArn : !If [ CreateSNSTopic, !Ref CloudTrailNotificationsTopic, !Ref TopicARN ]
106
+ Protocol : " https"
107
+ Endpoint : !Ref Endpoint
108
+
109
+ CloudTrailNotificationsPolicy :
110
+ Condition : CreateSNSTopic
111
+ Type : " AWS::SNS::TopicPolicy"
112
+ Properties :
113
+ Topics :
114
+ - !Ref CloudTrailNotificationsTopic
115
+ PolicyDocument :
116
+ Version : " 2012-10-17"
117
+ Statement :
118
+ - Sid : " AllowCloudTrailPublish"
75
119
Effect : " Allow"
76
- Action :
77
- - " s3:List*"
78
- Resource :
79
- - !Sub ' ${BucketARN}'
80
- - !Sub ' ${BucketARN}/*'
120
+ Principal :
121
+ Service : " cloudtrail.amazonaws.com"
122
+ Action : " SNS:Publish"
123
+ Resource : !Ref CloudTrailNotificationsTopic
124
+
125
+ Conditions :
126
+ CreateSNSTopic : !Equals [ !Ref CreateTopic, "true" ]
127
+
128
+ Outputs :
129
+ TopicARN :
130
+ Description : " The ARN of the SNS Topic created for CloudTrail notifications."
131
+ Value : !If [ CreateSNSTopic, !Ref CloudTrailNotificationsTopic, !Ref TopicARN ]
0 commit comments