Often times, a unique filename is needed for use in Terraform. We usually create resource "random_string"
.
resource "random_string" "random" { length = 5 special = false } data "archive_file" "lambda" { type = "zip" source_file = "lambda.py" output_path = "lambda-${random_string.random.result}.zip" }
I think it is a good idea to include the hash (md5 checksum) of its contents in the name of the archive. Then you can verify if the file content is compatible with the archive without having to unpack it.
Continue reading Terraform: Use a useful unique zip-name based on a md5 checksum