Skip to content

Commit 380d22d

Browse files
feat: file_system_config option
1 parent 18354c0 commit 380d22d

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<a href="https://cpco.io/homepage"><img src="https://github.com/cloudposse/terraform-aws-lambda-function/blob/main/.github/banner.png?raw=true" alt="Project Banner"/></a><br/>
55

66

7-
<p align="right"><a href="https://github.com/cloudposse/terraform-aws-lambda-function/releases/latest"><img src="https://img.shields.io/github/release/cloudposse/terraform-aws-lambda-function.svg?style=for-the-badge" alt="Latest Release"/></a><a href="https://github.com/cloudposse/terraform-aws-lambda-function/commits"><img src="https://img.shields.io/github/last-commit/cloudposse/terraform-aws-lambda-function.svg?style=for-the-badge" alt="Last Updated"/></a><a href="https://cloudposse.com/slack"><img src="https://slack.cloudposse.com/for-the-badge.svg" alt="Slack Community"/></a><a href="https://cloudposse.com/support/"><img src="https://img.shields.io/badge/Get_Support-success.svg?style=for-the-badge" alt="Get Support"/></a>
7+
<p align="right"><a href="https://github.com/cloudposse/terraform-aws-lambda-function/releases/latest"><img src="https://img.shields.io/github/release/cloudposse/terraform-aws-lambda-function.svg?style=for-the-badge" alt="Latest Release"/></a><a href="https://github.com/cloudposse/terraform-aws-lambda-function/commits"><img src="https://img.shields.io/github/last-commit/cloudposse/terraform-aws-lambda-function.svg?style=for-the-badge" alt="Last Updated"/></a><a href="https://cloudposse.com/slack"><img src="https://slack.cloudposse.com/for-the-badge.svg" alt="Slack Community"/></a>
88

99
</p>
1010
<!-- markdownlint-restore -->
@@ -30,8 +30,8 @@
3030
3131
-->
3232

33-
This module deploys an AWS Lambda function from a Zip file or from a Docker image. Additionally, it creates an IAM
34-
role for the Lambda function, which optionally attaches policies to allow for CloudWatch Logs, Cloudwatch Insights,
33+
This module deploys an AWS Lambda function from a Zip file or from a Docker image. Additionally, it creates an IAM
34+
role for the Lambda function, which optionally attaches policies to allow for CloudWatch Logs, Cloudwatch Insights,
3535
VPC Access and X-Ray tracing.
3636

3737

@@ -86,6 +86,10 @@ module "lambda" {
8686

8787

8888

89+
90+
91+
92+
8993
<!-- markdownlint-disable -->
9094
## Requirements
9195

@@ -147,6 +151,7 @@ module "lambda" {
147151
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
148152
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
149153
| <a name="input_ephemeral_storage_size"></a> [ephemeral\_storage\_size](#input\_ephemeral\_storage\_size) | The size of the Lambda function Ephemeral storage (/tmp) represented in MB.<br/> The minimum supported ephemeral\_storage value defaults to 512MB and the maximum supported value is 10240MB. | `number` | `null` | no |
154+
| <a name="input_file_system_config"></a> [file\_system\_config](#input\_file\_system\_config) | The Lambda file system configuration block with two required arguments:<br/> - *arn* - The ARN of the EFS file system to mount.<br/> - *local\_mount\_path* - The path where the file system is mounted in the Lambda execution environment. | <pre>object({<br/> arn = string<br/> local_mount_path = string<br/> })</pre> | `null` | no |
150155
| <a name="input_filename"></a> [filename](#input\_filename) | The path to the function's deployment package within the local filesystem. If defined, The s3\_-prefixed options and image\_uri cannot be used. | `string` | `null` | no |
151156
| <a name="input_function_name"></a> [function\_name](#input\_function\_name) | Unique name for the Lambda Function. | `string` | n/a | yes |
152157
| <a name="input_handler"></a> [handler](#input\_handler) | The function entrypoint in your code. | `string` | `null` | no |
@@ -200,11 +205,6 @@ module "lambda" {
200205
<!-- markdownlint-restore -->
201206

202207

203-
204-
205-
206-
207-
208208
## Related Projects
209209

210210
Check out these related projects.

main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ resource "aws_lambda_function" "this" {
8989
}
9090
}
9191

92+
dynamic "file_system_config" {
93+
for_each = var.file_system_config != null ? [var.file_system_config] : []
94+
content {
95+
arn = file_system_config.value.arn
96+
local_mount_path = file_system_config.value.local_mount_path
97+
}
98+
}
99+
92100
depends_on = [module.cloudwatch_log_group]
93101

94102
lifecycle {

variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ variable "filename" {
5858
default = null
5959
}
6060

61+
variable "file_system_config" {
62+
type = object({
63+
arn = string
64+
local_mount_path = string
65+
})
66+
description = <<EOF
67+
The Lambda file system configuration block with two required arguments:
68+
- *arn* - The ARN of the EFS file system to mount.
69+
- *local_mount_path* - The path where the file system is mounted in the Lambda execution environment.
70+
EOF
71+
default = null
72+
}
73+
6174
variable "function_name" {
6275
type = string
6376
description = "Unique name for the Lambda Function."

0 commit comments

Comments
 (0)