Skip to content

Commit

Permalink
feat: parameterise the MaximumEventAgeInSeconds, LogGroupName, and IA…
Browse files Browse the repository at this point in the history
…MRoleName for lambda-promtail CloudFormation template (#12728)
  • Loading branch information
InsomniaCoder authored Apr 29, 2024
1 parent 51a841f commit 8892dc8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tools/lambda-promtail/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Parameters:
Description: The maximum of concurrent executions you want to reserve for the function.
Type: Number
Default: 2
MaximumEventAgeInSeconds:
Description: The maximum age of a request that Lambda sends to a function for processing.
Type: Number
Default: 21600
Username:
Description: The basic auth username, necessary if writing directly to Grafana Cloud Loki.
Type: String
Expand Down Expand Up @@ -51,6 +55,14 @@ Parameters:
Description: Determines whether to verify the TLS certificate
Type: String
Default: "false"
LogGroupName:
Description: Name of the CloudWatch Log Group to subscribe from.
Type: String
Default: "/aws/lambda/some-lamda-log-group"
IAMRoleName:
Description: Name of the LambdaPromtailRole IAM Role.
Type: String
Default: "iam_for_lambda"

Resources:
LambdaPromtailRole:
Expand Down Expand Up @@ -78,7 +90,7 @@ Resources:
- logs:PutLogEvents
- logs:PutSubscriptionFilter
Resource: arn:aws:logs:*:*:*
RoleName: iam_for_lambda
RoleName: !Ref IAMRoleName
LambdaPromtailFunction:
Type: AWS::Lambda::Function
Properties:
Expand Down Expand Up @@ -119,6 +131,7 @@ Resources:
Properties:
FunctionName: !Ref LambdaPromtailFunction
MaximumRetryAttempts: 2
MaximumEventAgeInSeconds: !Ref MaximumEventAgeInSeconds
Qualifier: !GetAtt LambdaPromtailVersion.Version
# Copy this block and modify as required to create Subscription Filters for
# additional CloudWatch Log Groups.
Expand All @@ -128,7 +141,7 @@ Resources:
Properties:
DestinationArn: !GetAtt LambdaPromtailFunction.Arn
FilterPattern: ""
LogGroupName: "/aws/lambda/some-lamda-log-group"
LogGroupName: !Ref LogGroupName

Outputs:
LambdaPromtailFunction:
Expand Down

0 comments on commit 8892dc8

Please sign in to comment.