DEV Community

Discussion on: How to setup a Serverless application with AWS SAM and Terraform

Collapse
 
rolfstreefkerk profile image
Rolf Streefkerk

Thanks for reading! I'll try and answer below.

"do you re trigger terraform to update the lambdas?"

The trigger is on the Codepipeline configuration for the source code, you could have it trigger on git push to a branch that it will automatically start the pipeline.

"Could you just do this directly from sam repo?"

You can, sam features a deploy feature on the cli tool itself that you can use to deploy the stack directly to AWS. It's the same configuration that is in the CodePipeline build spec file.

"Why to still use terraform?"

I don't particularly like CloudFormation to perform resource deployments with, it's clunky it doesn't work well with changing resource states especially if they happen outside of the tooling for whatever reason. The drift "feature" is pointless without an automated way to correct it. Terraform state recording is much superior to fix Resource drift in my opinion.

Generally I only deploy Lambda related resources via AWS SAM, the API and Lambda's. The rest I configure and manage with Terraform.