You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-4
Original file line number
Diff line number
Diff line change
@@ -312,6 +312,9 @@ Hash of zip-archive created with the same content of the files is always identic
312
312
313
313
When calling this module multiple times in one execution to create packages with the same `source_path`, zip-archives will be corrupted due to concurrent writes into the same file. There are two solutions - set different values for `hash_extra` to create different archives, or create package once outside (using this module) and then pass `local_existing_package` argument to create other Lambda resources.
314
314
315
+
316
+
## <aname="build"></a> Debug
317
+
315
318
Building and packaging has been historically hard to debug (especially with Terraform), so we made an effort to make it easier for user to see debug info. There are 3 different debug levels: `DEBUG` - to see only what is happening during planning phase, `DEBUG2` - to see all logging values, `DEBUG3` - to see all logging values and env variables (be careful sharing your env variables as they may contain secrets!).
User can enable comments in heredoc strings in `patterns` which can be helpful in some situations. To do this set this environment variable:
328
+
329
+
```
330
+
export TF_LAMBDA_PACKAGE_PATTERN_COMMENTS=true
331
+
terraform apply
332
+
```
333
+
334
+
324
335
## <aname="build"></a> Build Dependencies
325
336
326
337
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.
@@ -340,11 +351,12 @@ When `source_path` is set to a list of directories the content of each will be t
340
351
341
352
### Combine various options for extreme flexibility
342
353
343
-
This is the most complete way of creating a deployment package from multiple sources with multiple dependencies. This example is showing all the available options:
354
+
This is the most complete way of creating a deployment package from multiple sources with multiple dependencies. This example is showing some of the available options (see [examples/build-package](https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/build-package) for more):
344
355
345
356
```hcl
346
357
source_path = [
347
358
"src/main-source",
359
+
"src/another-source/index.py",
348
360
{
349
361
path = "src/function1-dep",
350
362
patterns = [
@@ -357,6 +369,11 @@ source_path = [
357
369
}, {
358
370
path = "src/python3.8-app2",
359
371
pip_requirements = "requirements-large.txt",
372
+
patterns = [
373
+
"!vendor/colorful-0.5.4.dist-info/RECORD",
374
+
"!vendor/colorful-.+.dist-info/.*",
375
+
"!vendor/colorful/__pycache__/?.*",
376
+
]
360
377
}, {
361
378
path = "src/python3.8-app3",
362
379
commands = ["npm install"],
@@ -394,7 +411,7 @@ Few notes:
394
411
```
395
412
396
413
*`commands` - List of commands to run. If specified, this argument overrides `pip_requirements`.
397
-
*`pip_requirements` - Set to `true` to run `pip install` with `requirements.txt` found in `path`. Or set to another filename which you want to use instead.
414
+
*`pip_requirements` - Controls whether to execute `pip install`. Set to`false` to disable this feature,`true` to run `pip install` with `requirements.txt` found in `path`. Or set to another filename which you want to use instead.
398
415
*`prefix_in_zip` - If specified, will be used as a prefix inside zip-archive. By default, everything installs into the root of zip-archive.
399
416
400
417
@@ -429,6 +446,7 @@ When creating archive locally outside of this module you need to set `create_pac
429
446
}
430
447
```
431
448
449
+
432
450
### Using deployment package from remote URL
433
451
434
452
This can be implemented in two steps: download file locally using CURL, and pass path to deployment package as `local_existing_package` argument.
@@ -494,9 +512,9 @@ There is [deploy module](https://github.com/terraform-aws-modules/terraform-aws-
494
512
495
513
## FAQ
496
514
497
-
Q1: Why deployment package not recreating every time I change something?
515
+
Q1: Why deployment package not recreating every time I change something? Or why deployment package is being recreated every time but content has not been changed?
498
516
499
-
A1: There can be tons of reasons. The most likely is that changes has happened inside of dependency which is not used in calculating content hash. You can force it by setting value of `hash_extra`or to delete previously built package locally.
517
+
A1: There can be several reasons related to concurrent executions, or to content hash. Sometimes, changes has happened inside of dependency which is not used in calculating content hash. Or multiple packages are creating at the same time from the same sources. You can force it by setting value of `hash_extra` to distinct values.
0 commit comments