Serverless plugin for resolving variables from Terraform outputs
Clone or download
Latest commit 3be077b Jan 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Initial commit Jan 4, 2019
.gitignore Initial commit Jan 4, 2019
README.md Initial commit Jan 4, 2019
package-lock.json Initial commit Jan 4, 2019
package.json Initial commit Jan 4, 2019
tsconfig.json Initial commit Jan 4, 2019

README.md

serverless-terraform-outputs

Provides variable substitution resolution from Terraform outputs with workspace support:

${terraform:app-stage:sqs_queue_stuff.value.arn}

Usage

custom:
    stage: ${opt:stage, self:provider.stage}
    tf_workspace: ${self:custom.stage}

provider:
    environment:
        SQS_QUEUE: ${terraform:${self:custom.tf_workspace}:sqs_queue_stuff.value.url}

Prerequisites

Requires Terraform to be installed and accessible via the path, as well as minimal backend config: main.tf:

terraform {
    required_version = "0.11.8"
    backend "s3" {
        region               = "us-west-2"
        key                  = "project/foo"
        bucket               = "foosoft-terraform"
    }
}

For outputs from multiple Terraform configurations it is recommended to set them up as data sources and re-export the required vars.