add: Go function example (tf-go-hello-fn)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain")
|
||||
fmt.Fprintf(w, "Hello from Go in Fission")
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
fission = {
|
||||
source = "nail/fission"
|
||||
version = "~> 0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "fission" {
|
||||
kubeconfig_path = "/home/naeel/.kube/config"
|
||||
namespace = "default"
|
||||
}
|
||||
|
||||
resource "fission_environment" "go" {
|
||||
name = "tf-go-hello-env"
|
||||
image = "ghcr.io/fission/go-env"
|
||||
version = 3
|
||||
}
|
||||
|
||||
resource "fission_package" "pkg" {
|
||||
name = "tf-go-hello-pkg"
|
||||
environment = fission_environment.go.name
|
||||
source_dir = "${path.module}/code"
|
||||
}
|
||||
|
||||
resource "fission_function" "fn" {
|
||||
name = "tf-go-hello-fn"
|
||||
environment = fission_environment.go.name
|
||||
package_name = fission_package.pkg.name
|
||||
entrypoint = "main.Handler"
|
||||
}
|
||||
|
||||
resource "fission_http_trigger" "route" {
|
||||
name = "tf-go-hello-route"
|
||||
function = fission_function.fn.name
|
||||
url = "/go-hello"
|
||||
methods = ["GET"]
|
||||
}
|
||||
Reference in New Issue
Block a user