Native support for Terraform in SAM CLI (now in Beta)
See original GitHub issueTerraform Support
Recently we added native support for CDK applications in the SAM CLI - you can see our launch announcement blog post and download the beta version of the CLI.
We would like to collect the community’s feedback on whether we should add native support for Terraform in the SAM CLI. Terraform users would be able to use the SAM CLI’s build
, package
, local invoke
, and start-api
commands. The build
and package
commands make it easy to create deployment packages or OCI images that are ready to be used in AWS Lambda. The local invoke
and start-api
commands makes it easy to emulate AWS Lambda and API Gateway in local Docker container for testing purposes.
With this change, the SAM CLI would parse HCL definitions to understand functions and APIs that can be locally tested and built. The SAM CLI would not write HCL, translate to, or force the use of CloudFormation. Deployments should still be performed using the Terraform toolkit.
What feedback are we looking for?
- Is this something the community is interested in? **Vote with 👍🏽 **.
- The sam
build
,package
, andlocal invoke
commands rely on theCodeUri
property of a function resource pointing to a local path where the source code for the Lambda function is stored. The SAM CLI automatically pulls dependencies, compiles if necessary, and prepares a deployment package for AWS Lambda. The package command today produces an output template that contains the S3 URL for the deployment package the SAM CLI prepared. How would you like this work with Terraform?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:352
- Comments:25 (10 by maintainers)
@praneetap Let me share some statistics for the terraform-aws-lambda module.
Total provisions: 11.5M
on November 2022 (April 2022: 4.9M). This is more than all other Lambda modules published in the Registry combined.457,925 Clones
,86,982 Unique cloners
during the last 14 days.terragrunt
).I will share this issue with the community if anyone wants to upvote it.
Hello! SUPER excited to announce that our first step towards the full support - the ability to locally test and debug Lambda functions with SAM CLI, is now available in Beta. For the best experience, use it with terraform-aws-modules maintained by @antonbabenko , but you can also use it with custom modules as described in this blogpost. More details in the what’s new post here.
How can you help? As you can see, this is a preview of just the Lambda function testing, and we want to build on this based on your feedback and feature requests. You can give us feedback by-
Thanks in advance!