diff --git a/archive.tf b/archive.tf index e374bff..705a2ee 100644 --- a/archive.tf +++ b/archive.tf @@ -19,7 +19,7 @@ resource "null_resource" "archive" { } provisioner "local-exec" { - command = lookup(data.external.archive.result, "build_command") + command = var.silent ? join(" ", lookup(data.external.archive.result, "build_command"), "&>/dev/null") : lookup(data.external.archive.result, "build_command") working_dir = path.module } } @@ -33,7 +33,7 @@ data "external" "built" { program = ["python", "${path.module}/built.py"] query = { - build_command = lookup(data.external.archive.result, "build_command") + build_command = var.silent ? join(" ", lookup(data.external.archive.result, "build_command"), "&>/dev/null") : lookup(data.external.archive.result, "build_command") filename_old = lookup(null_resource.archive.triggers, "filename") filename_new = lookup(data.external.archive.result, "filename") module_relpath = path.module diff --git a/build.py b/build.py index afa3392..7a2cfb6 100644 --- a/build.py +++ b/build.py @@ -159,6 +159,11 @@ def dequote(value): '--target=.', '--requirement=requirements.txt', ) + if runtime.startswith('node'): + packageJson = os.path.join(temp_dir, 'package.json') + if os.path.exists(packageJson): + with cd(temp_dir): + run('npm','install','--prod',) # Zip up the temporary directory and write it to the target filename. # This will be used by the Lambda function as the source code package. diff --git a/variables.tf b/variables.tf index 1b17bd5..4dd224a 100644 --- a/variables.tf +++ b/variables.tf @@ -17,6 +17,11 @@ variable "source_path" { type = string } +variable "silent" { + description = "True if the output from the build should be silent" + type = bool +} + # Optional variables specific to this module. variable "build_command" {