question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Native support for Terraform in SAM CLI (now in Beta)

See original GitHub issue

Terraform 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?

  1. Is this something the community is interested in? **Vote with 👍🏽 **.
  2. The sam build, package, and local invoke commands rely on the CodeUri 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:open
  • Created 2 years ago
  • Reactions:352
  • Comments:25 (10 by maintainers)

github_iconTop GitHub Comments

50reactions
antonbabenkocommented, Nov 15, 2022

@praneetap Let me share some statistics for the terraform-aws-lambda module.

  1. Terraform Registry page says Total provisions: 11.5M on November 2022 (April 2022: 4.9M). This is more than all other Lambda modules published in the Registry combined.
  2. GitHub insights for the repo says: 457,925 Clones, 86,982 Unique cloners during the last 14 days.
  3. Some users use private forks of the module or don’t use Terraform Registry (e.g., using terragrunt).

I will share this issue with the community if anyone wants to upvote it.

10reactions
praneetapcommented, Nov 15, 2022

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-

  1. Creating an issue to track a request
  2. Connect with us on AWS developer Slack #samdev channel

Thanks in advance!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Better together: AWS SAM CLI and HashiCorp Terraform
With AWS SAM CLI's support for HashiCorp Terraform, developers can now use the AWS SAM CLI to test their serverless functions locally while ......
Read more >
Enhanced Serverless Development with Terraform and AWS ...
AWS announced support for local development and testing of AWS Serverless Application Model (AWS SAM) apps defined in Hashicorp Terraform ...
Read more >
How to setup a Serverless application ... - DEV Community ‍ ‍
The result is a great local development experience via AWS SAM combined with the power of Terraform as the glue and as a...
Read more >
aws-sam-cli Changelog - pyup.io
SAM CLI now supports running `sam package` without AWS CLI installed. This release also includes user experience improvements to interactive `sam init` command....
Read more >
Infrastructure as Code: Looking at SAM + CDK as a ... - Medium
At SSENSE we leverage two tools to do this: Hashicorp's Terraform and ... SAM CLI comes with a number of features to help...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found