@@ -21,17 +21,27 @@ Metadata:
2121 - serverless
2222 - loggroups
2323 - cloudwatch
24- LicenseUrl : s3://appdevstore/LoggroupConnector/v1.0.4/5122657d5b9a0d3713e24d3a33eae431
24+ LicenseUrl : s3://cf-templates-1qpf3unpuo1hw-us-east-1/test-log-group-lambda-connector/6092dd6c323e33634657102f570628e0
2525 Name : sumologic-loggroup-connector
26- ReadmeUrl : s3://appdevstore/LoggroupConnector/v1.0.4/c98f2c0d986a3f55fbea539688ee6a2e
27- SemanticVersion : 1.0.4
26+ ReadmeUrl : s3://cf-templates-1qpf3unpuo1hw-us-east-1/test-log-group-lambda-connector/946832fcaabeea8d4fa5580eb13fd90c
27+ SemanticVersion : 1.0.5
2828 SourceCodeUrl : https://github.com/SumoLogic/sumologic-aws-lambda/loggroup-lambda-connector
2929 SpdxLicenseId : Apache-2.0
3030Parameters :
31- LambdaARN :
31+ DestinationArnType :
32+ Type : String
33+ Description : Lambda - When the destination ARN for subscription filter is an AWS
34+ Lambda Function. Kinesis - When the destination ARN for subscription filter
35+ is an Kinesis or Amazon Kinesis data firehose stream.
36+ Default : Lambda
37+ AllowedValues :
38+ - Lambda
39+ - Kinesis
40+ DestinationArnValue :
3241 Type : String
3342 Default : arn:aws:lambda:us-east-1:123456789000:function:TestLambda
34- Description : Enter ARN for target lambda function
43+ Description : Enter Destination ARN like Lambda function, Kinesis stream. For more
44+ information, visit - https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/SubscriptionFilters.html
3545 LogGroupPattern :
3646 Type : String
3747 Default : Test
@@ -49,17 +59,57 @@ Parameters:
4959 Description : Enter comma separated keyvalue pairs for filtering logGroups using
5060 tags. Ex KeyName1=string,KeyName2=string. This is optional leave it blank if
5161 tag based filtering is not needed.
62+ RoleArn :
63+ Type : String
64+ Default : ' '
65+ Description : Enter AWS IAM Role arn in case the destination is Kinesis Firehose
66+ stream.
67+ Conditions :
68+ create_invoke_permission :
69+ Fn::Equals :
70+ - Ref : DestinationArnType
71+ - Lambda
72+ create_pass_role :
73+ Fn::Equals :
74+ - Ref : DestinationArnType
75+ - Kinesis
76+ Rules :
77+ testRoleArnWithLambda :
78+ RuleCondition :
79+ Fn::Equals :
80+ - Ref : DestinationArnType
81+ - Lambda
82+ Assertions :
83+ - Assert :
84+ Fn::Equals :
85+ - Ref : RoleArn
86+ - ' '
87+ AssertDescription : If Destination Type is Lambda, than the role ARN should be
88+ empty.
89+ testRoleArnWithKinesis :
90+ RuleCondition :
91+ Fn::Equals :
92+ - Ref : DestinationArnType
93+ - Kinesis
94+ Assertions :
95+ - Assert :
96+ Fn::Not :
97+ - Fn::Equals :
98+ - Ref : RoleArn
99+ - ' '
100+ AssertDescription : If Destination Type is Kinesis, than the role ARN can not
101+ be kept empty.
52102Resources :
53103 SumoLogGroupLambdaConnector :
54104 Type : AWS::Serverless::Function
55105 Properties :
56- CodeUri : s3://appdevstore/LoggroupConnector/v1.0.4/8822c7aea452b5df042a0d22e4ecd99d
106+ CodeUri : s3://cf-templates-1qpf3unpuo1hw-us-east-1/test-log-group-lambda-connector/44a32060109e4c7efa4feed59007b04f
57107 Handler : loggroup-lambda-connector.handler
58- Runtime : nodejs10 .x
108+ Runtime : nodejs14 .x
59109 Environment :
60110 Variables :
61- LAMBDA_ARN :
62- Ref : LambdaARN
111+ DESTINATION_ARN :
112+ Ref : DestinationArnValue
63113 LOG_GROUP_PATTERN :
64114 Ref : LogGroupPattern
65115 USE_EXISTING_LOG_GROUPS :
@@ -68,6 +118,8 @@ Resources:
68118 Fn::Join :
69119 - ' ,'
70120 - Ref : LogGroupTags
121+ ROLE_ARN :
122+ Ref : RoleArn
71123 Policies :
72124 - Statement :
73125 - Sid : ReadWriteFilterPolicy
@@ -90,12 +142,28 @@ Resources:
90142 - logs.amazonaws.com
91143 eventName :
92144 - CreateLogGroup
145+ sumoIAMPassRolePolicy :
146+ Type : AWS::IAM::Policy
147+ Condition : create_pass_role
148+ Properties :
149+ PolicyName : KinesisFirehoseLogsPolicy
150+ PolicyDocument :
151+ Version : ' 2012-10-17'
152+ Statement :
153+ - Effect : Allow
154+ Action :
155+ - iam:PassRole
156+ Resource :
157+ Ref : RoleArn
158+ Roles :
159+ - Ref : SumoLogGroupLambdaConnectorRole
93160 SumoCWLambdaInvokePermission :
94161 Type : AWS::Lambda::Permission
162+ Condition : create_invoke_permission
95163 Properties :
96164 Action : lambda:InvokeFunction
97165 FunctionName :
98- Ref : LambdaARN
166+ Ref : DestinationArnValue
99167 Principal :
100168 Fn::Sub : logs.${AWS::Region}.amazonaws.com
101169 SourceAccount :
0 commit comments