Terraform + Serverless

I have been taking a look at serverless’ github repo, and I see a lot of requests to add functionality to handle infrastructure creation.

For my projects I have decided to use serverless framework to deploys and handle infrastructure of: lambdas, apigateways, sns, cloudwatch events, it goes very sweet.

Any other infrastructure is managed via terraform (iam roles, policies attachments, dynamodb tables…etc).

Handling lambda functions integrations with apigateways via terraform is painful, so serverless has been a great gain. For other infrastructure terraform plans and terraform state works wonderfully.

Just want to get your thoughts/experience on that.

This topic has been discussed: Terraform with the Serverless Framework

take a look first.

1 Like

I have done this two ways now.

The first way was by maintaining a CloudFormation stack with Terraform whose sole purpose was to export Terraform variables through stack exports. It was straight forward to import these into the serverless config with the usual CF export caveats(ie can’t change them, can’t remove them while another stack is referencing them). I used variable versioning to get around this SqsQueueUrl_v1.

Recently I created a plugin that will resolve variable substitutions similar to the git and other plugins: erverless-terraform-outputs . Haven’t deployed this bit to prod yet so will have to see how it plays out.