Skip to content

Commit 7c7c56c

Browse files
authored
feat: Added example to show creation of Lambdas with for_each (#146)
1 parent a2fee34 commit 7c7c56c

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.48.0
3+
rev: v1.49.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate

examples/complete/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Note that this example may create resources which cost money. Run `terraform des
2020

2121
| Name | Version |
2222
|------|---------|
23-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.26 |
23+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
2424
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.67 |
2525
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2 |
2626

@@ -39,6 +39,7 @@ Note that this example may create resources which cost money. Run `terraform des
3939
| <a name="module_lambda_at_edge"></a> [lambda\_at\_edge](#module\_lambda\_at\_edge) | ../../ | |
4040
| <a name="module_lambda_function"></a> [lambda\_function](#module\_lambda\_function) | ../../ | |
4141
| <a name="module_lambda_function_existing_package_local"></a> [lambda\_function\_existing\_package\_local](#module\_lambda\_function\_existing\_package\_local) | ../../ | |
42+
| <a name="module_lambda_function_for_each"></a> [lambda\_function\_for\_each](#module\_lambda\_function\_for\_each) | ../../ | |
4243
| <a name="module_lambda_layer_local"></a> [lambda\_layer\_local](#module\_lambda\_layer\_local) | ../../ | |
4344
| <a name="module_lambda_layer_s3"></a> [lambda\_layer\_s3](#module\_lambda\_layer\_s3) | ../../ | |
4445
| <a name="module_lambda_with_mixed_trusted_entities"></a> [lambda\_with\_mixed\_trusted\_entities](#module\_lambda\_with\_mixed\_trusted\_entities) | ../../ | |

examples/complete/main.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,25 @@ module "lambda_with_mixed_trusted_entities" {
258258
]
259259
}
260260

261+
##############################
262+
# Lambda Functions + for_each
263+
##############################
264+
265+
module "lambda_function_for_each" {
266+
source = "../../"
267+
268+
for_each = toset(["dev", "staging", "prod"])
269+
270+
function_name = "my-${each.value}"
271+
description = "My awesome lambda function"
272+
handler = "index.lambda_handler"
273+
runtime = "python3.8"
274+
publish = true
275+
276+
create_package = false
277+
local_existing_package = "${path.module}/../fixtures/python3.8-zip/existing_package.zip"
278+
}
279+
261280
###########
262281
# Disabled
263282
###########

examples/complete/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 0.12.26"
2+
required_version = ">= 0.13"
33

44
required_providers {
55
aws = ">= 2.67"

0 commit comments

Comments
 (0)