forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
46 lines (36 loc) · 1.26 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as gcp from "@pulumi/gcp";
import { asset } from "@pulumi/pulumi";
const bucket = new gcp.storage.Bucket("bucket");
// Google Cloud Function in Python
const bucketObjectPython = new gcp.storage.BucketObject("python-zip", {
bucket: bucket.name,
source: new asset.AssetArchive({
".": new asset.FileArchive("./pythonfunc"),
}),
});
const functionPython = new gcp.cloudfunctions.Function("python-func", {
sourceArchiveBucket: bucket.name,
runtime: "python37",
sourceArchiveObject: bucketObjectPython.name,
entryPoint: "handler",
triggerHttp: true,
availableMemoryMb: 128,
});
export const pythonEndpoint = functionPython.httpsTriggerUrl;
// Google Cloud Function in Go
const bucketObjectGo = new gcp.storage.BucketObject("go-zip", {
bucket: bucket.name,
source: new asset.AssetArchive({
".": new asset.FileArchive("./gofunc"),
}),
});
const functionGo = new gcp.cloudfunctions.Function("go-func", {
sourceArchiveBucket: bucket.name,
runtime: "go111",
sourceArchiveObject: bucketObjectGo.name,
entryPoint: "Handler",
triggerHttp: true,
availableMemoryMb: 128,
});
export const goEndpoint = functionGo.httpsTriggerUrl;