Using TF 0.7.1 on a Win 10 machine.
My setup looks like this:
resource "archive_file" "cloudwatch-sumo-lambda-archive" {
source_file = "${var.lambda_src_dir}/cloudwatch/cloudwatchSumologic.js"
output_path = "${var.lambda_gen_dir}/cloudwatchSumologic.zip"
type = "zip"
}
resource "aws_lambda_function" "cloudwatch-sumo-lambda" {
function_name = "cloudwatch-sumo-lambda"
description = "managed by source project"
filename = "${archive_file.cloudwatch-sumo-lambda-archive.output_path}"
source_code_hash = "${archive_file.cloudwatch-sumo-lambda-archive.output_sha}"
handler = "cloudwatchSumologic.handler"
...
}
var.lambda_src_dir points to a sibling directory containing the javascript files for my various lambda functions (under source control).
var.lambda_gen_dir points to an external directory that is not under source control.
Before TF 0.7.1, my wrapper scripts would do the zipping of the js files into archive files in the lambda_gen_dir.
My process was to edit a javascript file, re-run my wrapper script, which would update the zip file and run the TF apply command and the lambda would be updated in AWS.
At first, I thought the above setup would negate the need for my wrapper scripts to do the archiving process and I could leave it to TF.
It works exactly right the first time, but if I then edit the javascript source code and re-run TF apply, it doesn't update the source in the zip file.
Weirdly, TF says it's applying a change to the lambda, but of course the lambda doesn't actually change (since the zip archive didn't actually change).
I can make the whole process work by editing the code, deleting the zip file, then running apply, but that just seems weird.
Is the current behaviour intended?