JSPM

serverless-terraform-variables

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q25149F
  • License MIT

Serverless plugin to retrieve terraform output variables for interpolation in serverless configuration.

Package Exports

  • serverless-terraform-variables

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-terraform-variables) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

serverless-terraform-variables

Build Status dependencies Status devDependencies Status

Interpolation of terraform output variables into a serverless configuration variable source.

Use terraform to manage the breadth of your networking, data, and auth layers, while using serverless to keep the quickly moving pieces moving quickly.

Simply stated, it allows this:

main.tf:

resource "aws_sqs_queue" "terraform_queue" {
  name = "terraform-example-queue"
}
output "sqs_id" {
  value = "${aws_sqs_queue.terraform_queue.id}"
}

serverless.yml:

functions:
  compute:
    handler: handler.compute
    events:
      - sqs: ${terraform:sqs_id}

Currently work-in-progress, but the initial commit is a fully functioning prototype.

Why?

Terraform and Serverless can serve the same purpose, but they do so with varying levels of success.

Terraform is great at large multi-team shared infrastructure.

Terraform's functionality of shared & saved state along with its module referencing powers allow it to be used for the majority of a company's provisioned dev ops, and its declarative and configuration-based approach allow it to be easily understood from a high level. However, terraform is not incredibly easy to pivot and iterate with.

Serverless is great at deploying functionality consistently and quickly.

Serverless' highly targeted platform-based approach allows it to be very efficient for any serverless platform, lessening the deploy time and upping the iteration. In addition, serverless is not restricted to the bounds of configuration - with a rich plugin ecosystem, you can code and do a lot of things with high efficiency. However, serverless is not terribly easy roll a full infrastructure with (especially with server-ful components).

Serverless-terraform-variables allows you to migrate any piece of terraform state forward into serverless.

Serverless-terraform-variables is great at integrating any terraform solution with a serverless solution - you get the both of best worlds while still remaining platform agnostic. You can take advantage of terraform to inject existing ops-managed infrastructure into a dev-owned environment of lambdas, managing just the deployment of your code with serverless while leaning on terraform to fetch and update any changes of infrastructure state that may affect your deployment.