forked from GoogleCloudPlatform/terraform-google-cloud-run
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
289 lines (260 loc) · 7.57 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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
/**
* Copyright 2021 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.
*/
// service
variable "project_id" {
description = "The project ID to deploy to"
type = string
}
variable "service_name" {
description = "The name of the Cloud Run service to create"
type = string
}
variable "location" {
description = "Cloud Run service deployment location"
type = string
}
variable "image" {
description = "GCR hosted image URL to deploy"
type = string
}
variable "generate_revision_name" {
type = bool
description = "Option to enable revision name generation"
default = true
}
variable "traffic_split" {
type = list(object({
latest_revision = bool
percent = number
revision_name = string
tag = string
}))
description = "Managing traffic routing to the service"
default = [{
latest_revision = true
percent = 100
revision_name = "v1-0-0"
tag = null
}]
}
variable "service_labels" {
type = map(string)
description = "A set of key/value label pairs to assign to the service"
default = {}
}
variable "service_annotations" {
type = map(string)
description = "Annotations to the service. Acceptable values all, internal, internal-and-cloud-load-balancing"
default = {
"run.googleapis.com/ingress" = "all"
}
}
// Metadata
variable "template_labels" {
type = map(string)
description = "A set of key/value label pairs to assign to the container metadata"
default = {}
}
variable "template_annotations" {
type = map(string)
description = "Annotations to the container metadata including VPC Connector and SQL. See [more details](https://cloud.google.com/run/docs/reference/rpc/google.cloud.run.v1#revisiontemplate)"
default = {
"run.googleapis.com/client-name" = "terraform"
"generated-by" = "terraform"
"autoscaling.knative.dev/maxScale" = 2
"autoscaling.knative.dev/minScale" = 1
}
}
variable "encryption_key" {
description = "CMEK encryption key self-link expected in the format projects/PROJECT/locations/LOCATION/keyRings/KEY-RING/cryptoKeys/CRYPTO-KEY."
type = string
default = null
}
// template spec
variable "container_concurrency" {
type = number
description = "Concurrent request limits to the service"
default = null
}
variable "timeout_seconds" {
type = number
description = "Timeout for each request"
default = 120
}
variable "service_account_email" {
type = string
description = "Service Account email needed for the service"
default = ""
}
variable "volumes" {
type = list(object({
name = string
secret = set(object({
secret_name = string
items = map(string)
}))
}))
description = "[Beta] Volumes needed for environment variables (when using secret)"
default = []
}
# template spec container
# resources
# cpu = (core count * 1000)m
# memory = (size) in Mi/Gi
variable "limits" {
type = map(string)
description = "Resource limits to the container"
default = null
}
variable "requests" {
type = map(string)
description = "Resource requests to the container"
default = {}
}
variable "ports" {
type = object({
name = string
port = number
})
description = "Port which the container listens to (http1 or h2c)"
default = {
name = "http1"
port = 8080
}
}
variable "argument" {
type = list(string)
description = "Arguments passed to the ENTRYPOINT command, include these only if image entrypoint needs arguments"
default = []
}
variable "container_command" {
type = list(string)
description = "Leave blank to use the ENTRYPOINT command defined in the container image, include these only if image entrypoint should be overwritten"
default = []
}
variable "startup_probe" {
type = object({
failure_threshold = optional(number, null)
initial_delay_seconds = optional(number, null)
timeout_seconds = optional(number, null)
period_seconds = optional(number, null)
http_get = optional(object({
path = optional(string)
http_headers = optional(list(object({
name = string
value = string
})), null)
port = optional(number)
}), null)
tcp_socket = optional(object({
port = optional(number)
}), null)
grpc = optional(object({
port = optional(number)
service = optional(string)
}), null)
})
default = null
description = <<-EOF
Startup probe of application within the container.
All other probes are disabled if a startup probe is provided, until it succeeds.
Container will not be added to service endpoints if the probe fails.
More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
EOF
}
variable "liveness_probe" {
type = object({
failure_threshold = optional(number, null)
initial_delay_seconds = optional(number, null)
timeout_seconds = optional(number, null)
period_seconds = optional(number, null)
http_get = optional(object({
path = optional(string)
http_headers = optional(list(object({
name = string
value = string
})), null)
port = optional(number)
}), null)
grpc = optional(object({
port = optional(number)
service = optional(string)
}), null)
})
default = null
description = <<-EOF
Periodic probe of container liveness. Container will be restarted if the probe fails.
More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
EOF
}
variable "env_vars" {
type = list(object({
value = string
name = string
}))
description = "Environment variables (cleartext)"
default = []
}
variable "env_secret_vars" {
type = list(object({
name = string
value_from = set(object({
secret_key_ref = map(string)
}))
}))
description = "[Beta] Environment variables (Secret Manager)"
default = []
}
variable "volume_mounts" {
type = list(object({
mount_path = string
name = string
}))
description = "[Beta] Volume Mounts to be attached to the container (when using secret)"
default = []
}
// Domain Mapping
variable "verified_domain_name" {
type = list(string)
description = "List of Custom Domain Name"
default = []
}
variable "force_override" {
type = bool
description = "Option to force override existing mapping"
default = false
}
variable "certificate_mode" {
type = string
description = "The mode of the certificate (NONE or AUTOMATIC)"
default = "NONE"
}
variable "domain_map_labels" {
type = map(string)
description = "A set of key/value label pairs to assign to the Domain mapping"
default = {}
}
variable "domain_map_annotations" {
type = map(string)
description = "Annotations to the domain map"
default = {}
}
// IAM
variable "members" {
type = list(string)
description = "Users/SAs to be given invoker access to the service"
default = []
}