Terraform module for creating AWS Lambda layers with minimal configuration.
module "my_layer" {
source = "./terraform-aws-lambda-layer"
namespace = "myorg"
name = "shared-utils"
source_dir = "./layer"
compatible_runtimes = ["provided.al2023", "python3.11"]
compatible_architectures = ["arm64"]
description = "Shared utilities layer"
}module "utils_layer" {
source = "./terraform-aws-lambda-layer"
name = "utils"
source_dir = "./src/layer"
}module "prebuilt_layer" {
source = "./terraform-aws-lambda-layer"
name = "prebuilt"
filename = "./dist/layer.zip"
}| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| source_dir | Path to source directory containing layer code | string |
null |
no |
| filename | Path to pre-built zip file | string |
null |
no |
| compatible_runtimes | List of compatible runtimes | list(string) |
["provided.al2023"] |
no |
| compatible_architectures | List of compatible architectures | list(string) |
["arm64"] |
no |
| description | Layer description | string |
null |
no |
| license_info | License information | string |
null |
no |
| Name | Description |
|---|---|
| layer_arn | Lambda layer ARN |
| layer_version | Lambda layer version |
| package_path | Path to deployment package |
| ssm_parameters | SSM parameter names for integration |
Your layer source directory should follow AWS Lambda layer conventions:
layer/
├── bin/ # Executables
├── lib/ # Libraries
└── python/ # Python packages (if using Python runtime)