Alternatively you could use the "archive_file" [0] resource provided by terraform. I use this resource to zip up my lambda source files and then use the hash of the zip file to determine if my application should be redeployed.
[0] https://registry.terraform.io/providers/hashicorp/archive/la...