How do I create multiple versions of a lambda function in terraform I have it creating one version. It has latest and version 2 but can’t getting it to create more than one version of the same lambda?

resource "aws_lambda_function" "lambda" {
  function_name = "test-lambda2"
  publish = true
  runtime = "python2.7"
  source_code_hash =  "${data.archive_file.lambda_zip.output_base64sha256}"                                             handler = "index.handler"
  filename = "lambda_function.zip"
  role = "${aws_iam_role.iam_for_lambda_tf.arn}"
}
This is shown in the Hashicorp tutorial - "a new version of the lambda function. The suggestion there is to point to a different zipfile in S3.

I suppose in your case, the filename either needs to change, or the file contents need to change.

The suggestion from the tutorial is to use a variable for the filename, associated with the version of the application.