Skip to content

v0.87.0

Compare
Choose a tag to compare
@cloudpossebot cloudpossebot released this 12 Mar 13:58
5ea3df7
Ability to specify source directory for Lambda@Edge submodule @zdmytriv (#260)

what

  • Ability to specify source directory for Lambda@Edge submodule

why

  • Currently, we can pass the list of files that will be archived and uploaded as Lambda sources. This is not an option if more advanced logic is used and a lot of files should be used.

Example

For example, we have the following file structure for lambda@edge submodule:

lambda_edge_example/
    lib/
        node_modules/
        index.js
        package.json
        package-lock.json
    context.tf
    main.tf
    outputs.tf
    variables.tf

And we want the whole directory lib to be packaged.

With this enhancement path to lib might be specified like this

module "lambda_edge" {
  source  = "cloudposse/cloudfront-s3-cdn/aws//modules/lambda@edge"
  version = "x.xx.x"

  functions = {
    viewer_request = {
      source_dir   = "${path.module}/lib/"
      runtime      = "nodejs12.x"
      handler      = "index.handler"
      event_type   = "viewer-request"
      include_body = false
    }
  }

  // ...
}

Related

Closes #205