The AWS SAM CLI uses Terraform commands to inspect the state of your project in order to identify Lambda resources with their source and package artifacts. Optionally, a Metadata resource will need to be defined in your Terraform config files for AWS SAM CLI to reference. With AWS SAM CLI support for Terraform, you can:
Use sam build to prepare for local testing.
Use sam local invoke and sam local start-lambda to debug and test your Lambda functions.