Skip to content

Commit

Permalink
inline local.archive_file to avoid type mismatch on conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
jansiwy committed Mar 17, 2021
1 parent 4211f81 commit 0e95ade
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ resource "aws_lambda_function" "this" {
}
}

filename = local.archive_file.output_path
source_code_hash = local.archive_file.output_base64sha256
filename = try(var.archive_file.output_path, data.archive_file.this[0].output_path)
source_code_hash = try(var.archive_file.output_base64sha256, data.archive_file.this[0].output_base64sha256)

tags = var.tags

Expand All @@ -34,10 +34,6 @@ data "archive_file" "this" {
output_path = ".terraform/tmp/lambda/${var.function_name}.zip"
}

locals {
archive_file = var.archive_file != null ? var.archive_file : data.archive_file.this[0]
}

resource "aws_iam_role" "this" {
name = "lambda-${var.function_name}"

Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variable "archive_file" {
type = object({
filename = string
source_code_hash = string
output_path = string
output_base64sha256 = string
})
default = null

Expand Down

0 comments on commit 0e95ade

Please sign in to comment.