Using terraform, I am provisioning cloudfront. One of the attribute is “lambda_function_association” where we associate a lambda to the cloudfront.
I get the following error message complaining about lambda function memory size
```
Error: error updating CloudFront Distribution (ENLY37UZ3CJCF):
InvalidLambdaFunctionAssociation: The function memory size is larger than the maximum
allowed size for functions that are triggered by a CloudFront event: 1024
Max allowed: 128 Function: arn:aws:lambda:us-east-1:myaccount:function:myaccount-
dev-cloudfrontheaders1:2
resource "aws_cloudfront_distribution" "clientcloudfrontdistrotest" {
default_cache_behavior {
forwarded_values {
query_string = true
cookies {
forward = "none"
}
}
lambda_function_association {
event_type = "viewer-response"
include_body = false
lambda_arn = var.lambda_arn
}
target_origin_id = var.targetoriginid
viewer_protocol_policy = var.viewerprotocolpolicy
}
}
resource "aws_cloudfront_origin_access_identity" "origin_access_identity" {
comment = "Origin Access ID for admin UI"
}