Skip to content

Commit b573d14

Browse files
committed
Update archive.tf
1 parent d71dcb3 commit b573d14

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

archive.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ module "assert_proper_output_archive_name" {
88
}
99

1010
// Create a UUID to be used for the output archive file name, so it doesn't clash with others
11-
resource "random_uuid" "archive_name" {}
11+
resource "random_uuid" "archive_name" {
12+
count = local.archive_needed ? 1 : 0
13+
}
1214

1315
locals {
1416
archive_needed = var.source_directory != null || var.unzipped_source_file != null
15-
output_default_filename = local.archive_needed && var.archive_output_name == null ? "${basename(var.source_directory != null ? var.source_directory : var.unzipped_source_file)}-${random_uuid.archive_name.result}.zip" : null
17+
output_default_filename = local.archive_needed && var.archive_output_name == null ? "${basename(var.source_directory != null ? var.source_directory : var.unzipped_source_file)}-${random_uuid.archive_name[0].result}.zip" : null
1618
archive_output_directory = trimsuffix(trimsuffix(var.archive_output_directory != null ? var.archive_output_directory : path.root, "/"), "\\")
1719
output_fullpath = local.archive_needed ? "${local.archive_output_directory}/${var.archive_output_name != null ? var.archive_output_name : local.output_default_filename}" : null
1820
// The name of the file for the Lambda resource to upload

0 commit comments

Comments
 (0)