Skip to content

Commit

Permalink
Merge pull request #27 from byu-oit/add-layers
Browse files Browse the repository at this point in the history
Expose "layers" lambda variable
  • Loading branch information
snelg authored Apr 22, 2022
2 parents 07069ab + e3b8936 commit f96eda1
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 12 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ Also Note: CodePipeline and CodeDeploy cannot be used together to deploy a Lambd
For a Zip file lambda
```hcl
module "lambda_api" {
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.0.1"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.1.0"
app_name = "my-lambda-codedeploy-dev"
env = "dev"
zip_filename = "./src/lambda.zip"
zip_handler = "index.handler"
zip_runtime = "nodejs12.x"
Expand All @@ -51,7 +50,7 @@ module "lambda_api" {
For a docker image lambda:
```hcl
module "lambda_api" {
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.0.1"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.1.0"
app_name = "my-docker-lambda"
image_uri = "my-image-from-my-ecr:latest"
hosted_zone = module.acs.route53_zone
Expand Down Expand Up @@ -111,7 +110,8 @@ module "lambda_api" {
| tags | map(string) | A map of AWS Tags to attach to each resource created | {} |
| role_permissions_boundary_arn | string | IAM Role Permissions Boundary ARN | |
| log_retention_in_days | number | CloudWatch log group retention in days. Defaults to 7. | 7 |
| lambda_policies | list(string) | List of IAM Policy ARNs to attach to the lambda role. | []' |
| lambda_policies | list(string) | List of IAM Policy ARNs to attach to the lambda role. | [] |
| lambda_layers | list(string) | List of Lambda Layer Version ARNs (maximum of 5) to attach to your function. | [] |
| timeout | number | How long the lambda will run (in seconds) before timing out | 3 (same as terraform default) |
| memory_size | number | Size of the memory of the lambda. CPU will scale along with it | 128 (same as terraform default) |
| xray_enabled | bool | Whether or not the X-Ray daemon should be created with the Lambda API. | false |
Expand Down
11 changes: 7 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v2.1.0
4/22/2022 - `lambda_layers` variable added as pass-through to `layers` variable of `aws_lambda_function` resource

## v2.0.1
3/11/2022 - increased `app_name` variable length
- increased `app_name` variable length from 24 to 28

## v2.0.0
2/24/2022 - Major breaking changes from v1.x:
- dropped support for terraform v0.12
Expand All @@ -10,7 +17,3 @@
- removed `use_codedeploy` variable - just include the codedeploy variables to enable codedeploy
- removed `env` variable - just include the env inside the `app_name` variable
- added `domain_url` variable to enable a custom API URL

## v2.0.1
3/11/2022 - increased `app_name` variable length
- increased `app_name` variable length from 24 to 28
2 changes: 1 addition & 1 deletion examples/docker-lambda/docker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "acs" {

module "lambda_api" {
# source = "../../"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.0.1"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.1.0"
app_name = "my-docker-lambda"
image_uri = "my-image-from-my-ecr:latest"
hosted_zone = module.acs.route53_zone
Expand Down
2 changes: 1 addition & 1 deletion examples/no-codedeploy/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "acs" {

module "lambda_api" {
# source = "../../"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.0.1"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.1.0"
app_name = "my-lambda-dev"
zip_filename = "./src/lambda.zip"
zip_handler = "index.handler"
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-lambda-in-vpc/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "acs" {

module "lambda_api" {
# source = "../../"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.0.1"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.1.0"
app_name = "my-lambda-dev"
zip_filename = "./src/lambda.zip"
zip_handler = "index.handler"
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-lambda-with-deploy-test/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module "acs" {

module "lambda_api" {
# source = "../../"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.0.1"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v2.1.0"
app_name = "my-lambda-codedeploy-dev"
env = "dev"
zip_filename = "./src/lambda.zip"
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ resource "aws_lambda_function" "zip_api" {
handler = var.zip_handler
runtime = var.zip_runtime
publish = true
layers = var.lambda_layers
timeout = var.timeout
memory_size = var.memory_size

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ variable "lambda_policies" {
default = []
}

variable "lambda_layers" {
type = list(string)
description = "List of Lambda Layer Version ARNs (maximum of 5) to attach to your function."
default = []
}

variable "timeout" {
type = number
description = "Timeout (in seconds) for lambda. Defaults to 3 (terraform default"
Expand Down

0 comments on commit f96eda1

Please sign in to comment.