feat: add fission_simple_function composite resource

This commit is contained in:
Naeel
2026-04-20 13:35:57 +03:00
parent 01df1498d6
commit ec23ddc0a6
6 changed files with 794 additions and 0 deletions
@@ -0,0 +1,12 @@
package main
import (
"net/http"
)
// Handler — точка входа для fission go-env.
func Handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte(`{"status":"processed"}`))
}
@@ -0,0 +1,2 @@
def main():
return {"status": "ok", "metrics": {}}
+34
View File
@@ -0,0 +1,34 @@
# ──────────────────────────────────────────────────────────────────────────────
# simple_functions.tf — примеры fission_simple_function (добавлено 2026-04-20)
#
# Демонстрирует использование нового составного ресурса, который заменяет
# отдельные fission_environment + fission_package + fission_function + fission_http_trigger
# одним блоком.
#
# Environment simple-<runtime>-env создаётся автоматически при первом apply.
# ──────────────────────────────────────────────────────────────────────────────
# ─── health-check (nodejs, с HTTPTrigger) ────────────────────────────────────
resource "fission_simple_function" "health" {
name = "ecom-health"
runtime = "nodejs"
code_dir = "${path.module}/code/node-health"
url = "/ecom/health"
methods = ["GET"]
}
# ─── metrics (python, без HTTPTrigger) ───────────────────────────────────────
resource "fission_simple_function" "metrics" {
name = "ecom-metrics"
runtime = "python"
code_dir = "${path.module}/code/python-metrics"
}
# ─── go-processor (go, с HTTPTrigger, PUT/POST) ───────────────────────────────
resource "fission_simple_function" "processor" {
name = "ecom-processor"
runtime = "go"
code_dir = "${path.module}/code/go-processor"
url = "/ecom/process"
methods = ["POST", "PUT"]
}