Enable Lambda insight on existing lambda function

Hi,

I have a build a aws lambda function with a layer. its works fine ( using https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function

Description ) I want to enable “Lambda insights” https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-Getting-Started.html

if we enable lambda insights manually from AWS console it adds a AWS provided layer in lambda function
for ex:
for my region is eu-west-1
aws provided layer is : arn:aws:lambda:eu-west-1:580247275435:layer:LambdaInsightsExtension:14

Issue )
It is clearly given in hashicorp how to enable/use a single layer while deploying a lambda function. However, I search hashicorp documentation ( & lot of google ) to find resource that describe how to achieve this via terraform i.e attaching AWS provided layer in existing lambda function ( which already has a layer attached )

If you guys can point me to right documentation or if any one has done with and can provide some tips then it will be highly appreciated.

1 Like