I am using terraform version 12.26 for AWS deployment. Whenever I try updating a lambda layer, the lambda layer version is incremented, but the older layer is deleted. Even though my current version of layer is for example 8, the older versions from 1 to 7 are automatically deleted.
I am using steps as mentioned here.
resource "aws_lambda_layer_version" "lambda_layer" {
filename = "lambda_layer_payload.zip"
layer_name = "lambda_layer_name"
source_code_hash = filebase64sha256("lambda_layer_payload.zip")
compatible_runtimes = ["nodejs12.x"]
}
How do I retain my older versions of layers?