Build & package lambda function on Terraform Cloud

What’s the best way to package & build a Nodejs lambda function on Terraform Cloud? On local machine, I can just write a script to run npm install before using an archive_file data source to zip the whole folder as lambda package while on Terraform Cloud, there seems to be no easy way.