From 10d18cc5646d797a00d760dae53c206c711ed663 Mon Sep 17 00:00:00 2001 From: David Atkins Date: Thu, 23 Apr 2020 13:47:20 +0100 Subject: [PATCH 1/3] Added dependency install for NodeJS --- build.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.py b/build.py index afa3392..e8aeadc 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',) # 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. From 71f06dcbb00700ea2e2cf6015c5fa8ef93aae525 Mon Sep 17 00:00:00 2001 From: David Atkins Date: Wed, 6 May 2020 09:19:58 +0100 Subject: [PATCH 2/3] Update build.py Co-authored-by: Loren Gordon --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index e8aeadc..7a2cfb6 100644 --- a/build.py +++ b/build.py @@ -163,7 +163,7 @@ def dequote(value): packageJson = os.path.join(temp_dir, 'package.json') if os.path.exists(packageJson): with cd(temp_dir): - run('npm','install',) + 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. From 785a077625a5a2d984750bf5fea41bc8b45c9ff4 Mon Sep 17 00:00:00 2001 From: David Atkins Date: Tue, 26 May 2020 15:06:29 +0100 Subject: [PATCH 3/3] Add option for silent supressed output --- archive.tf | 4 ++-- variables.tf | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) 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/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" {