-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.tf
60 lines (49 loc) · 1.78 KB
/
functions.tf
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Enable Cloud Functions API
resource "google_project_service" "cloudfunctions-api" {
service = "cloudfunctions.googleapis.com"
disable_on_destroy = false
}
# Configure Cloud Function asset-create. Assumes function code is already deployed
# terraform import google_cloudfunctions_function.asset-create asset-create
resource "google_cloudfunctions_function" "asset-create" {
name = "asset-create"
# description = "A function handles new asset object creations from a GCS bucket"
runtime = "python39"
entry_point = "main"
available_memory_mb = 512
service_account_email = "${google_service_account.assethandler.email}"
event_trigger {
event_type = "google.storage.object.finalize"
resource = "geosentry-assets"
failure_policy {
retry = false
}
}
labels = {
deployment-tool = "cli-gcloud"
}
}
# Configure Cloud Function region-create. Assumes function code is already deployed
# terraform import google_cloudfunctions_function.region-create region-create
resource "google_cloudfunctions_function" "region-create" {
name = "region-create"
# description = "A function handles new region document creations from Firestore"
runtime = "go113"
entry_point = "Main"
available_memory_mb = 256
service_account_email = "${google_service_account.invokehandler.email}"
event_trigger {
event_type = "providers/cloud.firestore/eventTypes/document.create"
resource = format("projects/%s/databases/(default)/documents/regions/{region}", var.project)
failure_policy {
retry = false
}
}
environment_variables = {
GCP_PROJECT = var.project
GCP_REGION = var.region
}
labels = {
deployment-tool = "cli-gcloud"
}
}