Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Added dependency install for NodeJS #70

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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: 2 additions & 2 deletions archive.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down