Skip to content

enter-at/terraform-aws-lambda-layer

Repository files navigation

terraform-aws-lambda-layer

Build Status Latest Release Semantic Release

Terraform module designed to facilitate the creation of AWS Lambda layers.


It's 100% Open Source and licensed under the APACHE2.

Usage

IMPORTANT: The main branch is used in source just as an example. In your code, do not pin to main because there may be breaking changes between releases. Instead pin to the release tag (e.g. ?ref=tags/x.y.z) of one of our latest releases.

Simple Example

module "layer" {
  source = "git::https://github.com/enter-at/terraform-aws-lambda-layer.git?ref=main"
  layer_name   = "dependencies"
  package_file = "../Pipfile"
}

Advanced Example

module "layer" {
  source = "git::https://github.com/enter-at/terraform-aws-lambda-layer.git?ref=main"
  layer_name   = "dependencies"
  source_dir   = "../src/lib"
  source_type  = "python"

  rsync_pattern = [
    "--exclude='**tests**'",
    "--exclude='**__pycache__**'",
    "--include=module/{a,b,c}/",
    "--include='*.py'",
    "--exclude='module/*'"
  ]
}

Requirements

Name Version
terraform >= 0.13

Providers

Name Version
archive n/a
aws n/a
null n/a
random n/a

Inputs

Name Description Type Default Required
compatible_runtimes (Optional) A list of Runtimes this layer is compatible with. Up to 5 runtimes can be specified. list(string) null no
description (Optional) Description of what the Lambda layer does. string null no
layer_name (Required) A unique name for the Lambda Layer. string n/a yes
package_file (Optional) The location of the package manager config file. Can be one of (package.json, requirements.txt, Pipfile) string null no
rsync_pattern (Optional) A list of rsync pattern to include or exclude files and directories. list(string)
[
"--include=*"
]
no
source_dir (Optional) The location of the Lamvda layer source code. Requires source_type to be defined. string null no
source_type (Optional) The location of the Lambda layer source type. Can be one of (nodejs, python) string null no

Outputs

Name Description
arn The Amazon Resource Name (ARN) of the Lambda layer with version.
created_date The date the layer was created.
layer_arn The Amazon Resource Name (ARN) of the Lambda layer without version.
source_code_size The size in bytes of the layer .zip file.
version The Lamba layer version.

Share the Love

Like this project? Please give it a ★ on our GitHub!

Related Projects

Check out these related projects.

  • terraform-aws-lambda - Terraform module designed to facilitate the creation of AWS Lambda functions.

Help

Got a question?

File a GitHub issue.

Contributing

Bug Reports & Feature Requests

Please use the issue tracker to report any bugs or file feature requests.

Developing

If you are interested in being a contributor and want to get involved in developing this project, we would love to hear from you!

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull Request so that we can review your changes

NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!

License

License

See LICENSE for full details.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.