Terraform support


#1

Is there a way to integrate with Terraform infrastructure management like what apex does?


#2

Serverless uses CloudFormation under the hood, so using Terraform is not beneficial (since the infrastructure is already code).


#3

Yup as rowanu already mentioned we’re built completely on top of CF (decided on that in the beginning instead of Terraform to stay close to AWS).

If you want to manage other resources in Terraform and deploy Serverless resources through CF thats definitely possible, you then just need to make sure that your Serverless functions can access those other resources you’ve set up through Terraform (although I think this would lead to a lot of pain to be honest)


#4

Thanks for the quick response!
I asked because some coworkers prefer terraform over CF because of past problems they had with some instability and confiability of CF. Did you guys have problems regarding CF that is important to mention?


#5

Not sure what they’re talking about with regards to instability with CloudFormation; I work solely with AWS and CFN is the way you manage AWS resources, and it was actually one of the reasons I started using the Serverless Framework - because it’s backed by CFN.

When I see articles like this about TF it makes me want to avoid it…


#6

We use Terraform in some of our internal Serverless projects as well (one of our engineers really likes it) and it has its up/downsides. For the main Serverless Services we want to go with the “provider native” configuration management system as any other system will simply not be used by larger companies, especially enterprises.


#7

@rowanu
I know this thread is pretty old, but I’m curious…
Is Cloudformation used even when the provider is Azure or Openwhisk? I’m not sure how it all works under the hood, but it seems like there must be (or should be?) some sort of vendor-agnostic format (like terraform) for codifying my infrastructure.

Edit: Just read the above comment, I guess that answers my question!

We use Terraform in some of our internal Serverless projects as well (one of our engineers really likes it) and it has its up/downsides. For the main Serverless Services we want to go with the “provider native” configuration management system as any other system will simply not be used by larger companies, especially enterprises.


#8

Couldn’t have answered it better myself!

My day job is consulting enterprises, and the sentiment in that quote is
spot on. TF also stores its state outside of the platform, which is
something I’m not personally a fan of.


#9

adding my perspective as a non-serverless user just passing by: The comments in this thread are all understandable if the majority of what you do is serverless. However in larger organisations it’s rarely the case. Terraform is vastly superior to native CFN, and so lots and lots of businesses with over 6 figure monthly AWS bills use terraform. It’s a complete headache to have to listen to someone tell you that you need to deploy serverless infra using sls deploy while pretty much everything else is terraform.

Something to consider?


#11

@walterheck @bill I’d address the points you raised in your posts, but both of you signed up to the forum just to to take pot shots, and it also doesn’t look like you have any actual Serverless Framework experience, so I’m probably not going to convince you of anything.

Have a great day!


#12

What would be helpful would be to reference Terraform variables in Serverless config just like you can do ${ssm:/foo/${opt:stage}/bar like ${tf:/foo/${opt:stage}/bar because in a large co, you’re likely going to have infrastructure that spans a wide variety of services (not just Serverless) and this would be very helpful.


#13

i stumbled upon that thread while searching for the best way of using serverless together with terraform because we decided to give terraform a shot.

i have one question: how are you using terraform? probably through some sort of CI-Tool? wouldnt it make sense to use the same tool for deploying serverless applications?


#14

Hmm - some not so informed responses WRT terraform above. Clearly, assuming that there’s just one hammer, CF or Terraform isn’t all that enlightened. We’re using terraform pretty heavily at WiserSolutions that offers us a lot of flexibility and control over QA and compliance across multiple providers for a variety of services, accounts etc.

Terraform has published a tutorial Serverless Applications with Lambda…. So, it wouldn’t be such a stretch to wonder if a Serverless Framework provider couldn’t be created to deliver awesome simplicity to the process.

Speaking for my team, it isn’t really a problem, we’ve got build tasks that can be parameterized per environment. We would appreciate a Terraform provider/plugin and I’m sure others would too.


#15

It’s an open source project. If you want support for terraform then create an issue at the Github repo, discuss the implementation in the issue and create a PR to add it.


#16

Like I said, it would be nice. Nice to have is not worth the effort. Just pointing out that it’s not a rediculous request.