diff --git a/EXAMPLE.md b/EXAMPLE.md
index 097c017..3818943 100644
--- a/EXAMPLE.md
+++ b/EXAMPLE.md
@@ -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.
```
diff --git a/README.md b/README.md
index 2f933b8..b7dae3d 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,7 @@ No modules.
| [image\_config\_entry\_point](#input\_image\_config\_entry\_point) | The ENTRYPOINT for the docker image | `list(string)` | `[]` | no |
| [image\_config\_working\_directory](#input\_image\_config\_working\_directory) | The working directory for the docker image | `string` | `null` | no |
| [image\_uri](#input\_image\_uri) | uri of image | `any` | `null` | no |
+| [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 |
| [lambda\_memory](#input\_lambda\_memory) | Required Memory for Lambda function | `number` | `128` | no |
| [lambda\_runtime](#input\_lambda\_runtime) | Lambda language | `any` | `null` | no |
| [lambda\_timeout](#input\_lambda\_timeout) | Required Timeout for Lambda function | `number` | `5` | no |
diff --git a/main.tf b/main.tf
index da527a0..2a33d5c 100644
--- a/main.tf
+++ b/main.tf
@@ -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
}
}
diff --git a/variables.tf b/variables.tf
index 950c40d..d002005 100644
--- a/variables.tf
+++ b/variables.tf
@@ -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