Skip to content

Commit

Permalink
Merge pull request #9 from byu-oit/feature/timeoutOption
Browse files Browse the repository at this point in the history
feature/timeoutOption -> master
  • Loading branch information
joshgubler authored Jun 3, 2020
2 parents e66a62a + a5129d9 commit 6c72f7a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Also Note: CodePipeline and CodeDeploy cannot be used together to deploy a Lambd
## Usage
```hcl
module "lambda_api" {
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v1.0.0"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v1.0.1"
app_name = "my-lambda"
env = "dev"
codedeploy_service_role_arn = module.acs.power_builder_role.arn
Expand All @@ -41,6 +41,8 @@ module "lambda_api" {
role_permissions_boundary_arn = module.acs.role_permissions_boundary.arn
codedeploy_test_listener_port = 4443
use_codedeploy = true
timeout = 3
memory_size = 128
codedeploy_lifecycle_hooks = {
BeforeAllowTraffic = aws_lambda_function.test_lambda.function_name
Expand Down Expand Up @@ -93,6 +95,8 @@ module "lambda_api" {
| lambda_policies | list(string) | List of IAM Policy ARNs to attach to the lambda role. | []
| security_groups | list(string) | List of extra security group IDs to attach to the lambda. | []
| use_codedeploy | bool | If true, CodeDeploy App and Deployment Group will be created and TF will not update alias to point to new versions of the Lambda (becuase CodeDeploy will do that). | false
| 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)

#### codedeploy_lifecycle_hooks

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=v1.0.0"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v1.0.1"
app_name = "my-lambda"
env = "dev"
lambda_zip_file = "./src/lambda.zip"
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=v1.0.0"
source = "github.com/byu-oit/terraform-aws-lambda-api?ref=v1.0.1"
app_name = "my-lambda-codedeploy"
env = "dev"
codedeploy_service_role_arn = module.acs.power_builder_role.arn
Expand Down
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ resource "aws_lambda_function" "api_lambda" {
handler = var.handler
runtime = var.runtime
publish = true
timeout = var.timeout
memory_size = var.memory_size

dynamic "environment" {
for_each = var.environment_variables != null ? [1] : []
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,16 @@ variable "use_codedeploy" {
type = bool
description = "If true, CodeDeploy App and Deployment Group will be created and TF will not update alias to point to new versions of the Lambda (becuase CodeDeploy will do that)."
default = false
}

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

variable "memory_size" {
type = number
description = "Memory Size of the lambda"
default = 128
}

0 comments on commit 6c72f7a

Please sign in to comment.