Skip to content

lambda: allow propagating Function tags to LogGroup #17533

@rittneje

Description

@rittneje

Description

When a lambda function is created via CDK, its LogGroup is not created right away. Instead it typically happens the first time the lambda executes. Consequently, the LogGroup does not have any of the function's tags applied to it. It would be nice if there were a way to mark the function to propagate tags to the LogGroup, perhaps via some custom resource. Ideally, this would be exposed as a mutable property so it can be toggled by an Aspect.

Use Case

We want to be able to easily find LogGroups corresponding to particular lambda function tags via the resource tagging API. In particular, this will allow us to easily find and delete these LogGroups when they are no longer needed.

Proposed Solution

Add a flag to the aws_lambda.Function construct indicating whether tags should be propagated. If so, create a custom resource to create the LogGroup if necessary, and then adjust its tags. It should account for adding new tags, deleting old tags, and modifying existing tags. It may be possible to combine this custom resource with the one that manages the LogGroup retention.

Other information

No response

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Labels

@aws-cdk/aws-lambdaRelated to AWS Lambdaeffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.in-progressThis issue is being actively worked on.p1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions