feat: provider v0.1.10 — source_dir (zip внутри провайдера), убран archive провайдер из всех примеров
This commit is contained in:
@@ -1,17 +1,6 @@
|
||||
# 2026-03-08
|
||||
# 2026-03-08 / Изменено: 2026-03-09
|
||||
# http.tf — HTTP-функция: принимает запросы, возвращает приветствие.
|
||||
# Код: code/handler-http.js
|
||||
#
|
||||
# Использование:
|
||||
# terraform apply
|
||||
# curl -s -X POST $(terraform output -raw trigger_url) \
|
||||
# -H 'Content-Type: application/json' -d '{"name":"Naeel"}'
|
||||
|
||||
data "archive_file" "handler_http" {
|
||||
type = "zip"
|
||||
source_file = "${path.module}/code/handler-http.js"
|
||||
output_path = "${path.module}/dist/handler-http.zip"
|
||||
}
|
||||
|
||||
resource "sless_function" "hello_http" {
|
||||
name = "hello-http"
|
||||
@@ -20,17 +9,13 @@ resource "sless_function" "hello_http" {
|
||||
memory_mb = 128
|
||||
timeout_sec = 30
|
||||
|
||||
code_path = data.archive_file.handler_http.output_path
|
||||
# filesha256 исходного файла — надёжнее чем output_md5 zip:
|
||||
# MD5 zip зависит от метаданных архива и может совпасть при разном содержимом
|
||||
code_hash = filesha256("${path.module}/code/handler-http.js")
|
||||
source_dir = "${path.module}/code"
|
||||
}
|
||||
|
||||
resource "sless_trigger" "hello_http" {
|
||||
name = "hello-http-trigger"
|
||||
type = "http"
|
||||
function = sless_function.hello_http.name
|
||||
# enabled = false — чтобы заморозить функцию (не удаляя ресурс), потом поставить зновь true
|
||||
enabled = true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user