<p>This is shown in the <a href="https://learn.hashicorp.com/terraform/aws/lambda-api-gateway#a-new-version-of-the-lambda-function" rel="nofollow noreferrer">Hashicorp tutorial - "a new version of the lambda function</a>. The suggestion there is to point to a different zipfile in S3.</p>

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

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

CC BY-SA 4.0
2019-10-15T14:06:41.693Z
2019-10-15T14:06:41.693Z
Bruce Becker
<p>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?</p>
<pre><code>resource &quot;aws_lambda_function&quot; &quot;lambda&quot; {
  function_name = &quot;test-lambda2&quot;
  publish = true
  runtime = &quot;python2.7&quot;
  source_code_hash =  &quot;${data.archive_file.lambda_zip.output_base64sha256}&quot;                                             handler = &quot;index.handler&quot;
  filename = &quot;lambda_function.zip&quot;
  role = &quot;${aws_iam_role.iam_for_lambda_tf.arn}&quot;
}
</code></pre>

<terraform><aws-lambda>
How do I create multiple versions of a lambda function in terraform
doug
# How do I create multiple versions of a lambda function in terraform

(Asked by: username_0 on 2019-10-15)

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}"
}

**Tags:** terraform, aws-lambda


---

## 1 answers

### Answer by username_1 on 2019-10-15. Score: 2 | Accepted answer

This is shown in the [Hashicorp tutorial - "a new version of the lambda function](https://learn.hashicorp.com/terraform/aws/lambda-api-gateway#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.


---

