-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathvariables.tf
264 lines (222 loc) · 6.27 KB
/
variables.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
variable "project_id" {
type = string
description = "Project ID"
}
variable "organization_id" {
type = number
description = "Organization ID"
default = 0
}
variable "function_name" {
type = string
description = "Cloud Function name"
}
variable "function_roles" {
type = list(string)
description = "Types of the function to assign permissions"
}
variable "pubsub_topic" {
type = string
description = "Pub/Sub topic (projects/project-id/topics/topic-id)"
default = null
}
variable "api" {
type = object({
enabled = optional(bool, false)
iam_invokers = optional(list(string), [])
})
description = "Run the function as API server (eg. non-Pub/Sub)"
default = null
}
variable "region" {
type = string
description = "Region to deploy function into"
default = "europe-west1"
}
variable "trigger_region" {
type = string
description = "Trigger region for Cloud Functions v2 (eg. set to global for Pub/Sub)"
default = null
}
variable "secret_id" {
type = string
description = "Secret Manager secret ID"
default = ""
}
variable "config_file" {
type = string
description = "Configuration file (either specify config_file or config)"
default = "config.yaml"
}
variable "config" {
type = string
description = "Configuration contents (either specify config_file or config)"
default = null
sensitive = true
}
variable "service_account" {
type = string
description = "Service account name"
default = ""
}
variable "create_service_account" {
type = bool
description = "Create a service account, set false to use service_account as-is."
default = true
}
variable "bucket_name" {
type = string
description = "Bucket for storing the Cloud Function"
default = "cf-pubsub2inbox"
}
variable "bucket_location" {
type = string
description = "Location of a bucket for storing the Cloud Function"
default = "EU"
}
variable "helper_bucket_name" {
type = string
description = "Helper bucket name for granting IAM permission (storage.objectAdmin)"
default = ""
}
variable "function_timeout" {
type = number
description = "Cloud Function timeout (maximum 540 seconds)"
default = 240
}
variable "available_memory_mb" {
type = number
description = "Maximum memory the function can use"
default = 512
}
variable "available_cpu" {
type = number
description = "Available CPUs to the function"
default = null
}
variable "container_concurrency" {
type = number
description = "Concurrency of requests to the container"
default = 8
}
variable "retry_minimum_backoff" {
type = string
description = "Minimum retry backoff (value between 0-600 seconds, suffixed with s, default 10s, Cloud Run only)"
default = "10s"
}
variable "retry_maximum_backoff" {
type = string
description = "Maximum retry backoff (value between 0-600 seconds, suffixed with s, default 600s, Cloud Run Only)"
default = "600s"
}
variable "instance_limits" {
type = object({
min_instances = number
max_instances = number
})
description = "Set default min/max instances"
default = {
min_instances = 0
max_instances = 100
}
}
variable "vpc_connector" {
type = string
description = "VPC connector ID for Cloud Function serverless access"
default = null
}
variable "vpc_egress" {
type = object({
network = string
subnetwork = string
tags = optional(string, "pubsub2inbox")
egress = optional(string, "all-traffic")
})
description = "Direct VPC egress configuration"
default = null
}
variable "cloudsql_connection" {
type = string
description = "Cloud SQL connection name"
default = null
}
variable "use_local_files" {
type = bool
description = "Use local function files (if set to false, uses http provider to download a release archive from Github)"
default = true
}
variable "local_files_path" {
type = string
description = "Local files path when use_local_files is true"
default = null
}
variable "release_version" {
type = string
description = "When not using local files, the release version to download"
default = "v1.7.0"
}
variable "cloud_run" {
type = bool
description = "Deploy via Cloud Run"
default = false
}
variable "cloud_functions_v2" {
type = bool
description = "Deploy via Cloud Functions v2"
default = false
}
variable "cloud_run_container" {
type = string
description = "Container URL when deploying via Cloud Run"
default = "ghcr.io/googlecloudplatform/pubsub2inbox:v1.4.5"
}
variable "log_level" {
type = number
description = "Set log level (10 equals debug)"
default = 10
}
variable "grant_token_creator" {
type = bool
description = "Grant serviceAccountTokenCreator on the service account to itself"
default = false
}
variable "deploy_json2pubsub" {
description = "Deploy Json2Pubsub alongside with this function (eg. for incoming webhooks)"
type = object({
enabled = bool
suffix = string
control_cel = string
message_cel = string
response_cel = string
public_access = bool
container_image = string
min_instances = number
max_instances = number
grant_sa_user = string
})
default = {
enabled = false
suffix = "-json2pubsub"
control_cel = "false"
message_cel = "request.json"
response_cel = ""
public_access = false
container_image = null
min_instances = 0
max_instances = 10
grant_sa_user = null
}
}