From 95c07d33844ebe8c3514cf42b8a3158376cd3036 Mon Sep 17 00:00:00 2001 From: Andrew Burnett Date: Fri, 25 Oct 2024 14:02:01 -0700 Subject: [PATCH 1/2] Allow quieting archive local exec --- README.md | 1 + package.tf | 1 + variables.tf | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 441726e3..30828216 100644 --- a/README.md +++ b/README.md @@ -835,6 +835,7 @@ No modules. | [provisioned\_concurrent\_executions](#input\_provisioned\_concurrent\_executions) | Amount of capacity to allocate. Set to 1 or greater to enable, or set to 0 to disable provisioned concurrency. | `number` | `-1` | no | | [publish](#input\_publish) | Whether to publish creation/change as new Lambda Function Version. | `bool` | `false` | no | | [putin\_khuylo](#input\_putin\_khuylo) | Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! | `bool` | `true` | no | +| [quiet\_archive\_local\_exec](#input\_quiet\_archive\_local\_exec) | Whether to disable archive local execution output. | `bool` | `false` | no | | [recreate\_missing\_package](#input\_recreate\_missing\_package) | Whether to recreate missing Lambda package if it is missing locally or not | `bool` | `true` | no | | [replace\_security\_groups\_on\_destroy](#input\_replace\_security\_groups\_on\_destroy) | (Optional) When true, all security groups defined in vpc\_security\_group\_ids will be replaced with the default security group after the function is destroyed. Set the replacement\_security\_group\_ids variable to use a custom list of security groups for replacement instead. | `bool` | `null` | no | | [replacement\_security\_group\_ids](#input\_replacement\_security\_group\_ids) | (Optional) List of security group IDs to assign to orphaned Lambda function network interfaces upon destruction. replace\_security\_groups\_on\_destroy must be set to true to use this attribute. | `list(string)` | `null` | no | diff --git a/package.tf b/package.tf index 34322514..a5d6338b 100644 --- a/package.tf +++ b/package.tf @@ -70,6 +70,7 @@ resource "null_resource" "archive" { "--timestamp", data.external.archive_prepare[0].result.timestamp ] command = data.external.archive_prepare[0].result.build_plan_filename + quiet = var.quiet_archive_local_exec } depends_on = [local_file.archive_plan] diff --git a/variables.tf b/variables.tf index ae55c936..c5890321 100644 --- a/variables.tf +++ b/variables.tf @@ -798,6 +798,12 @@ variable "trigger_on_package_timestamp" { default = true } +variable "quiet_archive_local_exec" { + description = "Whether to disable archive local execution output." + type = bool + default = false +} + ############################################ # Lambda Advanced Logging Settings ############################################ From a39166aeaf8ab51b802660db48c41c6db6d52d0e Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Fri, 16 May 2025 12:32:55 +0200 Subject: [PATCH 2/2] Fixed example --- examples/build-package/main.tf | 6 +- .../nodejs14.x-app1/package-lock.json | 102 ++++++++++++++++++ wrappers/main.tf | 1 + 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 examples/fixtures/nodejs14.x-app1/package-lock.json diff --git a/examples/build-package/main.tf b/examples/build-package/main.tf index 7119a5d5..7ecabf24 100644 --- a/examples/build-package/main.tf +++ b/examples/build-package/main.tf @@ -41,6 +41,8 @@ module "package_dir_pip_dir" { pip_requirements = "${path.module}/../fixtures/python-app1/requirements.txt" }] artifacts_dir = "${path.root}/builds/package_dir_pip_dir/" + + quiet_archive_local_exec = true } # Create zip-archive of a single directory where "poetry export" & "pip install --no-deps" will also be executed (using docker) @@ -82,6 +84,8 @@ module "package_src_poetry" { } ] artifacts_dir = "${path.root}/builds/package_src_poetry/" + + quiet_archive_local_exec = true } # Create zip-archive of a src directory where "poetry export" & "pip install --no-deps" will also be executed (using docker) @@ -255,7 +259,7 @@ module "npm_package_with_commands_and_patterns" { runtime = "nodejs18.x" source_path = [ { - path = "${path.module}/../fixtures/node-app" + path = "${path.module}/../fixtures/nodejs14.x-app1" commands = [ "[ ! -d node_modules ] || mv node_modules node_modules_temp", "npm install --production", diff --git a/examples/fixtures/nodejs14.x-app1/package-lock.json b/examples/fixtures/nodejs14.x-app1/package-lock.json new file mode 100644 index 00000000..ac2462ad --- /dev/null +++ b/examples/fixtures/nodejs14.x-app1/package-lock.json @@ -0,0 +1,102 @@ +{ + "name": "nodejs14.x-app1", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "nodejs14.x-app1", + "version": "1.0.0", + "dependencies": { + "requests": "^0.3.0" + } + }, + "node_modules/axo": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/axo/-/axo-0.0.2.tgz", + "integrity": "sha512-8CC4Mb+OhK97UEng0PgiqUDNZjzVcWDsV+G2vLYCQn1jEL7y6VqiRVlZlRu+aA/ckSznmNzW6X1I6nj2As/haQ==", + "license": "MIT" + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", + "license": "MIT" + }, + "node_modules/extendible": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/extendible/-/extendible-0.1.1.tgz", + "integrity": "sha512-AglckQA0TJV8/ZmhQcNmaaFcFFPXFIoZbfuoQOlGDK7Jh/roWotYzJ7ik1FBBCHBr8n7CgTR8lXXPAN8Rfb7rw==", + "license": "MIT" + }, + "node_modules/failure": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/failure/-/failure-1.1.1.tgz", + "integrity": "sha512-lzrrk0NUfjVeU3jLmfU01zP5bfg4XVFxHREYGvgJowaCqHLSQtqIGENH/CU+oSs6yfYObdSM7b9UY/3p2VJOSg==", + "license": "MIT" + }, + "node_modules/hang": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hang/-/hang-1.0.0.tgz", + "integrity": "sha512-vtBz98Bt/Tbm03cZO5Ymc7ZL8ead/jIx9T5Wg/xuz+9BXPAJNJSdGQW63LoaesogUQKTpHyal339hxTaTf/APg==", + "license": "MIT" + }, + "node_modules/loads": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/loads/-/loads-0.0.4.tgz", + "integrity": "sha512-XjPzzYIHkuMNqYyvh6AECQAHi682nyKO9TMdMYnaz7QbPDI/KIeSIjRhAlXIbRMPYAgtLUYgPlD3mtKZ4Q8SYA==", + "license": "MIT", + "dependencies": { + "failure": "1.1.x", + "one-time": "0.0.x", + "xhr-response": "1.0.x", + "xhr-status": "1.0.x" + } + }, + "node_modules/node-http-xhr": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/node-http-xhr/-/node-http-xhr-1.3.4.tgz", + "integrity": "sha512-0bA08/2RKWxw6pMkOVd3KP+0F5+ifQLMMTDxrCgxlgkoU1N8DhCbCSAYEqpgaVYM2smvbVVewiXjW+8AyoLfxQ==", + "license": "ISC" + }, + "node_modules/one-time": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-0.0.4.tgz", + "integrity": "sha512-qAMrwuk2xLEutlASoiPiAMW3EN3K96Ka/ilSXYr6qR1zSVXw2j7+yDSqGTC4T9apfLYxM3tLLjKvgPdAUK7kYQ==", + "license": "MIT" + }, + "node_modules/requests": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/requests/-/requests-0.3.0.tgz", + "integrity": "sha512-1B6nkiHjC1O1cSgFhEwkc+xd8vuj04h7xSmCg5yI8nmhCIKbPkX47od8erQ2pokBt5qxUO7dwP4jplXD6k6ISA==", + "license": "MIT", + "dependencies": { + "axo": "0.0.x", + "eventemitter3": "~4.0.0", + "extendible": "0.1.x", + "hang": "1.0.x", + "loads": "0.0.x", + "node-http-xhr": "~1.3.0", + "xhr-send": "1.0.x" + } + }, + "node_modules/xhr-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xhr-response/-/xhr-response-1.0.1.tgz", + "integrity": "sha512-m2FlVRCl3VqDcpc8UaWZJpwuHpFR2vYeXv6ipXU2Uuu4vNKFYVEFI0emuJN370Fge+JCbiAnS+JJmSoWVmWrjQ==", + "license": "MIT" + }, + "node_modules/xhr-send": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/xhr-send/-/xhr-send-1.0.0.tgz", + "integrity": "sha512-789EG4qW6Z0nPvG74AV3WWQCnBG5HxJXNiBsnEivZ8OpbvVA0amH0+g+MNT99o5kt/XLdRezm5KS1wJzcGJztw==", + "license": "MIT" + }, + "node_modules/xhr-status": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xhr-status/-/xhr-status-1.0.1.tgz", + "integrity": "sha512-VF0WSqtmkf56OmF26LCWsWvRb1a+WYGdHDoQnPPCVUQTM8CVUAOBcUDsm7nP7SQcgEEdrvF4DmhEADuXdGieyw==", + "license": "MIT" + } + } +} diff --git a/wrappers/main.tf b/wrappers/main.tf index bd3e58f2..9a2a8066 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -98,6 +98,7 @@ module "wrapper" { provisioned_concurrent_executions = try(each.value.provisioned_concurrent_executions, var.defaults.provisioned_concurrent_executions, -1) publish = try(each.value.publish, var.defaults.publish, false) putin_khuylo = try(each.value.putin_khuylo, var.defaults.putin_khuylo, true) + quiet_archive_local_exec = try(each.value.quiet_archive_local_exec, var.defaults.quiet_archive_local_exec, false) recreate_missing_package = try(each.value.recreate_missing_package, var.defaults.recreate_missing_package, true) replace_security_groups_on_destroy = try(each.value.replace_security_groups_on_destroy, var.defaults.replace_security_groups_on_destroy, null) replacement_security_group_ids = try(each.value.replacement_security_group_ids, var.defaults.replacement_security_group_ids, null)