I’m trying to update my Lambda function’s description with a variable that changes on every run (I’m using part of TFC_CONFIGURATION_VERSION_GIT_COMMIT_SHA
). I only want the Lambda function to update when there are changes to fields that are not the description
but when those other fields do change, I want the description
to be updated. I thought this was how it worked but my descriptions are not getting updated when the code changes.
This is what my Lambda definition looks like:
resource aws_lambda_function cloudfront_errors {
function_name = "cloudfront-errors"
description = "TFC Build (${var.tfc_git_hash})"
runtime = "nodejs12.x"
role = aws_iam_role.cloudfront_errors.arn
handler = "index.handler"
filename = data.archive_file.cloudfront_errors.output_path
source_code_hash = data.archive_file.cloudfront_errors.output_base64sha256
publish = true
lifecycle {
ignore_changes = [
description]
}
}
If I remove the ignore_changes
block, the Lambda function updates on every plan. If I leave it in, the description
value never changes (even though the value of var.tfc_git_hash
does change.
This lives in the “nice to have” world but the behavior goes against what I was expecting. Any ideas how to achieve what I’m trying to do?