I'm trying to run and debug a lambda function locally using the AWS CLI and OpenTofu. Using sam build --hook-name terraform
works great. However, now that Terraform is no longer open-source, I'd like to migrate to OpenTofu. Is there a way to use sam build
with an OpenTofu hook?
Since OpenTofu is backwards-compatible with Terraform, create a symbolic link for Terraform that is actually OpenTofu.
Note: you may need to use sudo
.
$ which tofu
/usr/local/bin/tofu
$ ln -s /usr/local/bin/tofu /usr/local/bin/terraform
Another option is to install Terraform locally and use Terraform for sam build
.
If you are only looking to debug a TypeScript lambda locally with VSCode, follow this.