From 04f28d9a7e2afc1e64ff98b5765f4e68531f10db Mon Sep 17 00:00:00 2001 From: Vimal Paliwal Date: Mon, 1 Dec 2025 11:45:51 +0000 Subject: [PATCH] add support for tenant isolation mode feature --- README.md | 5 +++-- main.tf | 7 +++++++ variables.tf | 6 ++++++ versions.tf | 2 +- wrappers/main.tf | 1 + wrappers/versions.tf | 2 +- 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3d045ce0..593b3e6f 100644 --- a/README.md +++ b/README.md @@ -667,7 +667,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.5.7 | -| [aws](#requirement\_aws) | >= 6.0 | +| [aws](#requirement\_aws) | >= 6.23.0 | | [external](#requirement\_external) | >= 1.0 | | [local](#requirement\_local) | >= 1.0 | | [null](#requirement\_null) | >= 2.0 | @@ -676,7 +676,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 6.0 | +| [aws](#provider\_aws) | >= 6.23.0 | | [external](#provider\_external) | >= 1.0 | | [local](#provider\_local) | >= 1.0 | | [null](#provider\_null) | >= 2.0 | @@ -858,6 +858,7 @@ No modules. | [source\_path](#input\_source\_path) | The absolute path to a local file or directory containing your Lambda source code | `any` | `null` | no | | [store\_on\_s3](#input\_store\_on\_s3) | Whether to store produced artifacts on S3 or locally. | `bool` | `false` | no | | [tags](#input\_tags) | A map of tags to assign to resources. | `map(string)` | `{}` | no | +| [tenant\_isolation\_mode](#input\_tenant\_isolation\_mode) | Enable tenant isolation mode for the Lambda Function | `bool` | `false` | no | | [timeout](#input\_timeout) | The amount of time your Lambda Function has to run in seconds. | `number` | `3` | no | | [timeouts](#input\_timeouts) | Define maximum timeout for creating, updating, and deleting Lambda Function resources | `map(string)` | `{}` | no | | [tracing\_mode](#input\_tracing\_mode) | Tracing mode of the Lambda Function. Valid value can be either PassThrough or Active. | `string` | `null` | no | diff --git a/main.tf b/main.tf index cc7d011a..33dd0ced 100644 --- a/main.tf +++ b/main.tf @@ -139,6 +139,13 @@ resource "aws_lambda_function" "this" { } } + dynamic "tenancy_config" { + for_each = var.tenant_isolation_mode ? [true] : [] + content { + tenant_isolation_mode = "PER_TENANT" + } + } + tags = merge( var.include_default_tag ? { terraform-aws-modules = "lambda" } : {}, var.tags, diff --git a/variables.tf b/variables.tf index 6ea454f6..8f98b252 100644 --- a/variables.tf +++ b/variables.tf @@ -278,6 +278,12 @@ variable "skip_destroy" { default = null } +variable "tenant_isolation_mode" { + description = "Enable tenant isolation mode for the Lambda Function" + type = bool + default = false +} + ############### # Function URL ############### diff --git a/versions.tf b/versions.tf index 8dea461c..82caa51c 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.23.0" } external = { source = "hashicorp/external" diff --git a/wrappers/main.tf b/wrappers/main.tf index eb78bb41..efe127f7 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -128,6 +128,7 @@ module "wrapper" { source_path = try(each.value.source_path, var.defaults.source_path, null) store_on_s3 = try(each.value.store_on_s3, var.defaults.store_on_s3, false) tags = try(each.value.tags, var.defaults.tags, {}) + tenant_isolation_mode = try(each.value.tenant_isolation_mode, var.defaults.tenant_isolation_mode, false) timeout = try(each.value.timeout, var.defaults.timeout, 3) timeouts = try(each.value.timeouts, var.defaults.timeouts, {}) tracing_mode = try(each.value.tracing_mode, var.defaults.tracing_mode, null) diff --git a/wrappers/versions.tf b/wrappers/versions.tf index 8dea461c..82caa51c 100644 --- a/wrappers/versions.tf +++ b/wrappers/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 6.0" + version = ">= 6.23.0" } external = { source = "hashicorp/external"