diff --git a/hello-node/code/handler-http.js b/hello-node/code/handler-http.js index ec016dc..9766375 100644 --- a/hello-node/code/handler-http.js +++ b/hello-node/code/handler-http.js @@ -3,6 +3,6 @@ // Используется с sless_trigger (постоянный эндпоинт). exports.handle = async (event) => { const name = event.name || 'World'; - return { message: `Hello, ${name}!` }; + return { message: `Hello, ${name}! HTTP ` }; }; diff --git a/hello-node/handler-http.zip b/hello-node/handler-http.zip index 03b9353..8ce3f7d 100644 Binary files a/hello-node/handler-http.zip and b/hello-node/handler-http.zip differ diff --git a/hello-node/http.tf b/hello-node/http.tf index e0678ca..c45fd6a 100644 --- a/hello-node/http.tf +++ b/hello-node/http.tf @@ -22,7 +22,9 @@ resource "sless_function" "hello_http" { timeout_sec = 30 code_path = data.archive_file.handler_http.output_path - code_hash = data.archive_file.handler_http.output_md5 + # filesha256 исходного файла — надёжнее чем output_md5 zip: + # MD5 zip зависит от метаданных архива и может совпасть при разном содержимом + code_hash = filesha256("${path.module}/code/handler-http.js") } resource "sless_trigger" "hello_http" { diff --git a/hello-node/job.tf b/hello-node/job.tf index 5692465..59b2d27 100644 --- a/hello-node/job.tf +++ b/hello-node/job.tf @@ -24,7 +24,8 @@ resource "sless_function" "hello_job" { timeout_sec = 30 code_path = data.archive_file.handler_job.output_path - code_hash = data.archive_file.handler_job.output_md5 + # filesha256 исходного файла — надёжнее чем output_md5 zip + code_hash = filesha256("${path.module}/code/handler-job.js") } # Одноразовый запуск. Все поля immutable — изменение любого пересоздаёт джоб. diff --git a/hello-node/main.tf b/hello-node/main.tf index 6e11712..b861a85 100644 --- a/hello-node/main.tf +++ b/hello-node/main.tf @@ -8,7 +8,7 @@ terraform { required_providers { sless = { source = "terra.k8c.ru/naeel/sless" - version = "~> 0.1.4" + version = "~> 0.1.5" } archive = { source = "hashicorp/archive"