Skip to content

Commit 12c4f7e

Browse files
committed
add support for vpc_config.ipv6_allowed_for_dual_stack
1 parent 4f77bfc commit 12c4f7e

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,7 @@ No modules.
864864
| <a name="input_trigger_on_package_timestamp"></a> [trigger\_on\_package\_timestamp](#input\_trigger\_on\_package\_timestamp) | Whether to recreate the Lambda package if the timestamp changes | `bool` | `true` | no |
865865
| <a name="input_trusted_entities"></a> [trusted\_entities](#input\_trusted\_entities) | List of additional trusted entities for assuming Lambda Function role (trust relationship) | `any` | `[]` | no |
866866
| <a name="input_use_existing_cloudwatch_log_group"></a> [use\_existing\_cloudwatch\_log\_group](#input\_use\_existing\_cloudwatch\_log\_group) | Whether to use an existing CloudWatch log group or create new | `bool` | `false` | no |
867+
| <a name="input_vpc_ipv6_allowed_for_dual_stack"></a> [vpc\_ipv6\_allowed\_for\_dual\_stack](#input\_vpc\_ipv6\_allowed\_for\_dual\_stack) | Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets. | `bool` | `false` | no |
867868
| <a name="input_vpc_security_group_ids"></a> [vpc\_security\_group\_ids](#input\_vpc\_security\_group\_ids) | List of security group ids when Lambda Function should run in the VPC. | `list(string)` | `null` | no |
868869
| <a name="input_vpc_subnet_ids"></a> [vpc\_subnet\_ids](#input\_vpc\_subnet\_ids) | List of subnet ids when Lambda Function should run in the VPC. Usually private or intra subnets. | `list(string)` | `null` | no |
869870

examples/with-vpc/main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ module "lambda_function_in_vpc" {
1717
function_name = "${random_pet.this.id}-lambda-in-vpc"
1818
description = "My awesome lambda function"
1919
handler = "index.lambda_handler"
20-
runtime = "python3.8"
20+
runtime = "python3.9"
2121

2222
source_path = "${path.module}/../fixtures/python3.8-app1"
2323

2424
vpc_subnet_ids = module.vpc.intra_subnets
2525
vpc_security_group_ids = [module.vpc.default_security_group_id]
26+
vpc_ipv6_allowed_for_dual_stack = true
2627
attach_network_policy = true
2728
replace_security_groups_on_destroy = true
2829
replacement_security_group_ids = [module.vpc.default_security_group_id]
@@ -38,6 +39,9 @@ module "vpc" {
3839
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
3940
intra_subnets = ["10.10.101.0/24", "10.10.102.0/24", "10.10.103.0/24"]
4041

42+
enable_ipv6 = true
43+
intra_subnet_ipv6_prefixes = [0, 1, 2]
44+
4145
# Add public_subnets and NAT Gateway to allow access to internet from Lambda
4246
# public_subnets = ["10.10.1.0/24", "10.10.2.0/24", "10.10.3.0/24"]
4347
# enable_nat_gateway = true

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ resource "aws_lambda_function" "this" {
9191
dynamic "vpc_config" {
9292
for_each = var.vpc_subnet_ids != null && var.vpc_security_group_ids != null ? [true] : []
9393
content {
94-
security_group_ids = var.vpc_security_group_ids
95-
subnet_ids = var.vpc_subnet_ids
94+
ipv6_allowed_for_dual_stack = var.vpc_ipv6_allowed_for_dual_stack
95+
security_group_ids = var.vpc_security_group_ids
96+
subnet_ids = var.vpc_subnet_ids
9697
}
9798
}
9899

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ variable "vpc_security_group_ids" {
176176
default = null
177177
}
178178

179+
variable "vpc_ipv6_allowed_for_dual_stack" {
180+
description = "Allows outbound IPv6 traffic on VPC functions that are connected to dual-stack subnets."
181+
type = bool
182+
default = false
183+
}
184+
179185
variable "tags" {
180186
description = "A map of tags to assign to resources."
181187
type = map(string)

wrappers/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ module "wrapper" {
129129
trigger_on_package_timestamp = try(each.value.trigger_on_package_timestamp, var.defaults.trigger_on_package_timestamp, true)
130130
trusted_entities = try(each.value.trusted_entities, var.defaults.trusted_entities, [])
131131
use_existing_cloudwatch_log_group = try(each.value.use_existing_cloudwatch_log_group, var.defaults.use_existing_cloudwatch_log_group, false)
132+
vpc_ipv6_allowed_for_dual_stack = try(each.value.vpc_ipv6_allowed_for_dual_stack, var.defaults.vpc_ipv6_allowed_for_dual_stack, false)
132133
vpc_security_group_ids = try(each.value.vpc_security_group_ids, var.defaults.vpc_security_group_ids, null)
133134
vpc_subnet_ids = try(each.value.vpc_subnet_ids, var.defaults.vpc_subnet_ids, null)
134135
}

0 commit comments

Comments
 (0)