From f1abf32421f3e5f2063171cfe343d9e76dda8736 Mon Sep 17 00:00:00 2001 From: Edward Date: Thu, 31 Dec 2020 14:19:34 -0500 Subject: [PATCH] docs: Improved package.py error message for missing source_paths (#88) --- README.md | 2 +- package.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d56f0a74..31d5579a 100644 --- a/README.md +++ b/README.md @@ -351,7 +351,7 @@ terraform apply ## Build Dependencies -You can specify `source_path` in a variety of ways to achieve desired flexibility when building deployment packages locally or in Docker. You can use absolute or relative paths. +You can specify `source_path` in a variety of ways to achieve desired flexibility when building deployment packages locally or in Docker. You can use absolute or relative paths. If you have placed terraform files in subdirectories, note that relative paths are specified from the directory where `terraform plan` is run and not the location of your terraform file. Note that, when building locally, files are not copying anywhere from the source directories when making packages, we use fast Python regular expressions to find matching files and directories, which makes packaging very fast and easy to understand. diff --git a/package.py b/package.py index b99ca2cb..1e6d159b 100644 --- a/package.py +++ b/package.py @@ -698,7 +698,10 @@ def commands_step(path, commands): if isinstance(claim, str): path = claim if not os.path.exists(path): - abort('source_path must be set.') + abort('Could not locate source_path "{path}". Paths are relative to directory where `terraform plan` is being run ("{pwd}")'.format( + path=path, + pwd=os.getcwd() + )) runtime = query.runtime if runtime.startswith('python'): pip_requirements_step(