Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.2.1

- [Empty environment is handled correctly](https://github.com/babbel/terraform-aws-lambda-with-inline-code/pull/15)

## v1.2.0

- [Bump hashicorp/aws dependency](https://github.com/babbel/terraform-aws-lambda-with-inline-code/pull/14)
Expand Down
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ resource "aws_lambda_function" "this" {
role = aws_iam_role.this.arn

dynamic "environment" {
for_each = local.environment_variables != null ? [{ variables = local.environment_variables }] : []
// local.environments is built using a merge, and merges always result in a map
// so we can safely assume we're dealing with a map here.
for_each = length(local.environment_variables) > 0 ? [{ variables = local.environment_variables }] : []

content {
variables = environment.value.variables
Expand Down