DEV Community

Soumya Ranjan Naik
Soumya Ranjan Naik

Posted on

How to convert aws sam into terraform ?

I have a AWS SAM app and I want the equivalent Terraform code for that because our organization uses another tool to manage AWS which only accepts terraform.

I want atleast the sam template to convert into terraform.

If you have any idea on how to do it or any reference then please comment.

Discussion (2)

Collapse
loujaybee profile image
Lou (πŸš€ Open Up The Cloud ☁️) • Edited

I've not heard of any way to directly convert the two, but you can use your infra as a source of truth. Terraform can import resources into state to be managed. terraform.io/docs/cli/import/index...

You can also use the "show" command to convert state into TF code: terraform.io/docs/cli/commands/sta...

I've also used: github.com/dtan4/terraforming in the past.

Hope that helps !

Collapse
soumyaranjannaik profile image
Soumya Ranjan Naik Author

Ohh thanks for the information and resources.