Terraform with the Serverless Framework

One of the developers on my team has started to manage our staging environment with Terraform and the response has been positive. We are definitely going to be using Terraform instead of Cloudformation from now on.

However, we also love using the Serverless Framework. Does anyone have any experience working with Terraform + Serverless Framework?

Thank you

3 Likes

My understanding is that the framework exclusively uses CF, I would imagine you would need to develop a new provider if you were going down this road.

I use Terraform a lot (yes, I like it more than Cloudformation templates). It can make the job done super fast if compare the time to maintain Cloudformation template (it easily goes up to thousands lines)

But terraform is not good for serverless related resources, it is still too complex or feature missed to be managed by terraform. We still need Serverless framework to manage the lambda/api gateway, dynamodb separately

I spent a couple weeks trying to get this to work before I found out terraform isn’t supporting it. IMO, terraform needs a “doesn’t really support API Gateway” on the front page / README.

If anyone has found a way to actually use API Gateway from terraform in production (without lots of manual setup), I’d love to pick your brain. Right now, I’m forced to consider alternatives like serverless, Zappa, or CloudFormation.

Mixed serverless framework and terraform are not bad idea at all. In fact, with current functions in terraform, you have to mix it with serverless framework to deal with API Gateway.

Afraid I don’t, but am also interested. I find Cloudformation lacking in cases where you need to do do some conditional logic prior to provisioning.

Unfortunately I’m afraid @sime is right and it may not be easy to implement. For example, if you are to use plugins, you generally have to overwrite a compiledCloudformationTemplate parameter.

Terraform is the way forward in my case! Love to continue to use serverless however CF is not long term solution.

That’s great to hear that there are others out there also interested in using Terraform w/ Serverless. Our team has found CF very tedious to write and hard to manage, but the serverless framework config is less verbose.

So adding another Provider would be the best way if we really wanted to integrate Terraform w/ Serverless Franework, or is having a mix of both a good idea?

Thanks

Very interested in this because our team uses Terraform, but are also exploring the serverless framework.

The best info I can find so far in 2019 is: https://theburningmonk.com/2019/03/making-terraform-and-serverless-framework-work-together/