diff --git a/README.md b/README.md
index 005c2a38..64c74e36 100644
--- a/README.md
+++ b/README.md
@@ -148,7 +148,7 @@ resource "aws_s3_bucket" "builds" {
acl = "private"
}
-resource "aws_s3_bucket_object" "my_function" {
+resource "aws_s3_object" "my_function" {
bucket = aws_s3_bucket.builds.id
key = "${filemd5(local.my_function_source)}.zip"
source = local.my_function_source
@@ -165,7 +165,7 @@ module "lambda_function_existing_package_s3" {
create_package = false
s3_existing_package = {
bucket = aws_s3_bucket.builds.id
- key = aws_s3_bucket_object.my_function.id
+ key = aws_s3_object.my_function.id
}
}
```
@@ -602,7 +602,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo
| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.13.1 |
-| [aws](#requirement\_aws) | >= 3.69 |
+| [aws](#requirement\_aws) | >= 4.8.0 |
| [external](#requirement\_external) | >= 1.0 |
| [local](#requirement\_local) | >= 1.0 |
| [null](#requirement\_null) | >= 2.0 |
@@ -611,7 +611,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 3.69 |
+| [aws](#provider\_aws) | >= 4.8.0 |
| [external](#provider\_external) | >= 1.0 |
| [local](#provider\_local) | >= 1.0 |
| [null](#provider\_null) | >= 2.0 |
@@ -651,7 +651,7 @@ No modules.
| [aws_lambda_permission.current_version_triggers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
| [aws_lambda_permission.unqualified_alias_triggers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_permission) | resource |
| [aws_lambda_provisioned_concurrency_config.current_version](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_provisioned_concurrency_config) | resource |
-| [aws_s3_bucket_object.lambda_package](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_object) | resource |
+| [aws_s3_object.lambda_package](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_object) | resource |
| [local_file.archive_plan](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/file) | resource |
| [null_resource.archive](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [aws_arn.log_group_arn](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/arn) | data source |
@@ -710,6 +710,7 @@ No modules.
| [docker\_pip\_cache](#input\_docker\_pip\_cache) | Whether to mount a shared pip cache folder into docker environment or not | `any` | `null` | no |
| [docker\_with\_ssh\_agent](#input\_docker\_with\_ssh\_agent) | Whether to pass SSH\_AUTH\_SOCK into docker environment or not | `bool` | `false` | no |
| [environment\_variables](#input\_environment\_variables) | A map that defines environment variables for the Lambda Function. | `map(string)` | `{}` | no |
+| [ephemeral\_storage\_size](#input\_ephemeral\_storage\_size) | Amount of ephemeral storage size (`/tmp`) in MB your Lambda Function can use at runtime. Valid value between 512 MB to 10,240 MB (10 GB). | `number` | `512` | no |
| [event\_source\_mapping](#input\_event\_source\_mapping) | Map of event source mapping | `any` | `{}` | no |
| [file\_system\_arn](#input\_file\_system\_arn) | The Amazon Resource Name (ARN) of the Amazon EFS Access Point that provides access to the file system. | `string` | `null` | no |
| [file\_system\_local\_mount\_path](#input\_file\_system\_local\_mount\_path) | The path where the function can access the file system, starting with /mnt/. | `string` | `null` | no |
diff --git a/examples/complete/main.tf b/examples/complete/main.tf
index 4c4a0208..56bc0383 100644
--- a/examples/complete/main.tf
+++ b/examples/complete/main.tf
@@ -17,12 +17,13 @@ provider "aws" {
module "lambda_function" {
source = "../../"
- function_name = "${random_pet.this.id}-lambda1"
- description = "My awesome lambda function"
- handler = "index.lambda_handler"
- runtime = "python3.8"
- architectures = ["x86_64"]
- publish = true
+ function_name = "${random_pet.this.id}-lambda1"
+ description = "My awesome lambda function"
+ handler = "index.lambda_handler"
+ runtime = "python3.8"
+ ephemeral_storage_size = 10240
+ architectures = ["x86_64"]
+ publish = true
source_path = "${path.module}/../fixtures/python3.8-app1"
diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf
index a32909ec..9e58d511 100644
--- a/examples/complete/versions.tf
+++ b/examples/complete/versions.tf
@@ -2,7 +2,7 @@ terraform {
required_version = ">= 0.13.1"
required_providers {
- aws = ">= 2.67"
+ aws = ">= 4.8.0"
random = ">= 2"
}
}
diff --git a/main.tf b/main.tf
index 24f81116..5296554c 100644
--- a/main.tf
+++ b/main.tf
@@ -15,7 +15,7 @@ locals {
# s3_* - to get package from S3
s3_bucket = var.s3_existing_package != null ? lookup(var.s3_existing_package, "bucket", null) : (var.store_on_s3 ? var.s3_bucket : null)
s3_key = var.s3_existing_package != null ? lookup(var.s3_existing_package, "key", null) : (var.store_on_s3 ? var.s3_prefix != null ? format("%s%s", var.s3_prefix, replace(local.archive_filename_string, "/^.*//", "")) : replace(local.archive_filename_string, "/^\\.//", "") : null)
- s3_object_version = var.s3_existing_package != null ? lookup(var.s3_existing_package, "version_id", null) : (var.store_on_s3 ? try(aws_s3_bucket_object.lambda_package[0].version_id, null) : null)
+ s3_object_version = var.s3_existing_package != null ? lookup(var.s3_existing_package, "version_id", null) : (var.store_on_s3 ? try(aws_s3_object.lambda_package[0].version_id, null) : null)
}
@@ -37,6 +37,10 @@ resource "aws_lambda_function" "this" {
package_type = var.package_type
architectures = var.architectures
+ ephemeral_storage {
+ size = var.ephemeral_storage_size
+ }
+
filename = local.filename
source_code_hash = var.ignore_source_code_hash ? null : (local.filename == null ? false : fileexists(local.filename)) && !local.was_missing ? filebase64sha256(local.filename) : null
@@ -96,7 +100,7 @@ resource "aws_lambda_function" "this" {
# When a lambda function is invoked, AWS creates the log group automatically if it doesn't exist yet.
# Without the dependency, this can result in a race condition if the lambda function is invoked before
# Terraform can create the log group.
- depends_on = [null_resource.archive, aws_s3_bucket_object.lambda_package, aws_cloudwatch_log_group.lambda]
+ depends_on = [null_resource.archive, aws_s3_object.lambda_package, aws_cloudwatch_log_group.lambda]
}
resource "aws_lambda_layer_version" "this" {
@@ -117,10 +121,10 @@ resource "aws_lambda_layer_version" "this" {
s3_key = local.s3_key
s3_object_version = local.s3_object_version
- depends_on = [null_resource.archive, aws_s3_bucket_object.lambda_package]
+ depends_on = [null_resource.archive, aws_s3_object.lambda_package]
}
-resource "aws_s3_bucket_object" "lambda_package" {
+resource "aws_s3_object" "lambda_package" {
count = local.create && var.store_on_s3 && var.create_package ? 1 : 0
bucket = var.s3_bucket
diff --git a/variables.tf b/variables.tf
index 24243bfa..b1751877 100644
--- a/variables.tf
+++ b/variables.tf
@@ -103,6 +103,12 @@ variable "memory_size" {
default = 128
}
+variable "ephemeral_storage_size" {
+ description = "Amount of ephemeral storage (/tmp) in MB your Lambda Function can use at runtime. Valid value between 512 MB to 10,240 MB (10 GB)."
+ type = number
+ default = 512
+}
+
variable "publish" {
description = "Whether to publish creation/change as new Lambda Function Version."
type = bool
diff --git a/versions.tf b/versions.tf
index 3727a394..e54af37b 100644
--- a/versions.tf
+++ b/versions.tf
@@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 3.69"
+ version = ">= 4.8.0"
}
external = {
source = "hashicorp/external"