Integrating the Serverless Framework and Terraform

Gavin Lewis
The Startup
Published in
3 min readMay 21, 2019

--

A few weeks ago, Thales Minussi wrote a great article on his approach to combining the Serverless Framework and Terraform together, we had a further discussion on LinkedIn about how I’ve approached this in the past. To expand on my solution, this is how I approach integrating the two tools.

Background

So why you would ever need to use the Serverless Framework and Terraform together? While the Serverless Framework is great and it allows you to deploy applications quickly and easily, not all AWS services or all components of AWS services are available to be deployed by CloudFormation, which forms the basis for the Serverless Framework and also AWS’ SAM. Let’s take a look at a real-world scenario.

One of the teams where I work has been building a mobile application and wanted to use Push Notifications. I designed the overall solution for the push notifications service, which included the following components:

  • API Gateway
  • Lambda
  • DynamoDB
  • SNS

Sounds like a perfect candidate for the Serverless Framework, right? The only problem is SNS does not support the creation of Platform Applications in CloudFormation (at the time of writing), only regular Topics. Terraform to the rescue!

--

--

Gavin Lewis
The Startup

Passionate about building and delivering solutions in the Cloud! Principal Cloud Architect @ Rapid Circle. Views are my own.