Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ module "lambda_test" {
}
```

## Create lambda resource attached to dual-stack subnets
When the provided subnets are dual-stack (IPv4 and IPv6), set `ipv6_allowed_for_dual_stack` to `true` to allow the Lambda function to send outbound traffic over IPv6.
```
module "lambda_test" {
source = "./lambda"
function_name = "${var.prefix}-test-lambda"
handler = "lambda.handler"
lambda_runtime = "python3.x"
s3_bucket = "${var.prefix}-test-lambda"
s3_key = "lambda.zip"
description = "Lambda resource attached to dual-stack subnets"
security_group_ids = ["sg-1234567"]
subnets = ["subnet-1", "subnet-2"]
ipv6_allowed_for_dual_stack = true
logs_retention = 14
}
```

## Allow apigw to invoke lambda
Api gateway will invoke the lambda function where function is created from zip file named lambda.zip uploaded in s3 bucket where key is path for zip file in the bucket.
```
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ No modules.
| <a name="input_image_config_entry_point"></a> [image\_config\_entry\_point](#input\_image\_config\_entry\_point) | The ENTRYPOINT for the docker image | `list(string)` | `[]` | no |
| <a name="input_image_config_working_directory"></a> [image\_config\_working\_directory](#input\_image\_config\_working\_directory) | The working directory for the docker image | `string` | `null` | no |
| <a name="input_image_uri"></a> [image\_uri](#input\_image\_uri) | uri of image | `any` | `null` | no |
| <a name="input_ipv6_allowed_for_dual_stack"></a> [ipv6\_allowed\_for\_dual\_stack](#input\_ipv6\_allowed\_for\_dual\_stack) | Allows outbound IPv6 traffic on VPC functions attached to dual-stack subnets | `bool` | `false` | no |
| <a name="input_lambda_memory"></a> [lambda\_memory](#input\_lambda\_memory) | Required Memory for Lambda function | `number` | `128` | no |
| <a name="input_lambda_runtime"></a> [lambda\_runtime](#input\_lambda\_runtime) | Lambda language | `any` | `null` | no |
| <a name="input_lambda_timeout"></a> [lambda\_timeout](#input\_lambda\_timeout) | Required Timeout for Lambda function | `number` | `5` | no |
Expand Down
5 changes: 3 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ resource "aws_lambda_function" "lambda" {
dynamic "vpc_config" {
for_each = var.subnets != null && var.security_group_ids != null ? [true] : []
content {
security_group_ids = var.security_group_ids
subnet_ids = var.subnets
security_group_ids = var.security_group_ids
subnet_ids = var.subnets
ipv6_allowed_for_dual_stack = var.ipv6_allowed_for_dual_stack
}
}

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

variable "ipv6_allowed_for_dual_stack" {
description = "Allows outbound IPv6 traffic on VPC functions attached to dual-stack subnets"
type = bool
default = false
}

variable "logs_retention" {
description = "Specifies the number of days you want to retain log events in the specified log group"
type = number
Expand Down