-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcloud_functions.tf
99 lines (90 loc) · 3.88 KB
/
cloud_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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
locals {
environment_variables = {
ELEVATED_NOTARY_BACKEND = google_cloud_run_service.elevated_notary.status[0].url
ELEVATED_NOTARY_QPH = "30"
EMAILS_BACKEND = "https://mails-k3cimrd2pq-uc.a.run.app"
EMAILS_QPH = "5"
JWT_SIGNING_KEY = data.google_kms_secret.jwt_signing_key.plaintext
NOTARY_BACKEND = google_cloud_run_service.notary.status[0].url
NOTARY_QPH = "30"
OPERATOR_BACKEND = google_cloud_run_service.operator.status[0].url
OPERATOR_QPH = "5"
REDIS_HOST = "${google_redis_instance.ratelimit.host}:${google_redis_instance.ratelimit.port}"
}
labels = {
deployment-tool = "cli-gcloud"
}
}
resource "google_cloudfunctions_function" "operator" {
name = "Operator"
description = "Operator proxy method"
runtime = "go113"
available_memory_mb = 128
trigger_http = true
entry_point = "Operator"
vpc_connector = google_vpc_access_connector.default.name
environment_variables = local.environment_variables
labels = local.labels
}
resource "google_cloudfunctions_function_iam_member" "operator_invoker" {
project = google_cloudfunctions_function.operator.project
region = google_cloudfunctions_function.operator.region
cloud_function = google_cloudfunctions_function.operator.name
role = "roles/cloudfunctions.invoker"
member = "allUsers"
}
resource "google_cloudfunctions_function" "notary" {
name = "Notary"
description = "Notary proxy method"
runtime = "go113"
available_memory_mb = 128
trigger_http = true
entry_point = "Notary"
vpc_connector = google_vpc_access_connector.default.name
environment_variables = local.environment_variables
labels = local.labels
}
resource "google_cloudfunctions_function_iam_member" "notary_invoker" {
project = google_cloudfunctions_function.notary.project
region = google_cloudfunctions_function.notary.region
cloud_function = google_cloudfunctions_function.notary.name
role = "roles/cloudfunctions.invoker"
member = "allUsers"
}
resource "google_cloudfunctions_function" "elevated_notary" {
name = "ElevatedNotary"
description = "ElevatedNotary proxy method"
runtime = "go113"
available_memory_mb = 128
trigger_http = true
entry_point = "ElevatedNotary"
vpc_connector = google_vpc_access_connector.default.name
environment_variables = local.environment_variables
labels = local.labels
}
resource "google_cloudfunctions_function_iam_member" "elevated_notary_invoker" {
project = google_cloudfunctions_function.elevated_notary.project
region = google_cloudfunctions_function.elevated_notary.region
cloud_function = google_cloudfunctions_function.elevated_notary.name
role = "roles/cloudfunctions.invoker"
member = "allUsers"
}
# Note: private service used to collect email addresses on https://covidtrace.com landing page
resource "google_cloudfunctions_function" "emails" {
name = "Emails"
description = "Emails proxy method"
runtime = "go113"
available_memory_mb = 128
trigger_http = true
entry_point = "Emails"
vpc_connector = google_vpc_access_connector.default.name
environment_variables = local.environment_variables
labels = local.labels
}
resource "google_cloudfunctions_function_iam_member" "emails_invoker" {
project = google_cloudfunctions_function.emails.project
region = google_cloudfunctions_function.emails.region
cloud_function = google_cloudfunctions_function.emails.name
role = "roles/cloudfunctions.invoker"
member = "allUsers"
}