Got a lambda handler written in Typescript. So I have a compile script:
"precompile": "rm -rf dist",
"compile": "npx tsc --moduleResolution node --outDir dist --sourceMap false",
Works fine. Then I thought I'd zip up the dist
folder and the node_modules
before uploading (with a prune beforehand):
# zip the handler code before sending it
data "archive_file" "lambda_zip_file" {
type = "zip"
source_dir = "${path.module}/../dist"
source_dir = "${path.module}/../node_modules"
output_path = "${path.module}/../${var.tempfolder}/${local.prefix}.zip"
}
OK well source_dir
doesn't allow two sources. Or an array of sources. So my alternative is to cp
the node_modules
folder to the dist
folder before I call Terraform. Which isn't a big deal, just wondering if there's a better way that I'm not seeing. Cleaner if I don't have a temp folder to in my file tree.
Terraform 1.0.x