-
Notifications
You must be signed in to change notification settings - Fork 29
/
variables.tf
197 lines (164 loc) · 4.99 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
variable name {
type = string
description = "Name of the service."
}
variable image {
type = string
description = "Docker image name."
}
variable location {
type = string
description = "Location of the service."
}
// --
variable allow_public_access {
type = bool
default = true
description = "Allow unauthenticated access to the service."
}
variable args {
type = list(string)
default = []
description = "Arguments to pass to the entrypoint."
}
variable cloudsql_connections {
type = set(string)
default = []
description = "Cloud SQL connections to attach to container instances."
}
variable concurrency {
type = number
default = null
description = "Maximum allowed concurrent requests per container for this revision."
}
variable cpu_throttling {
type = bool
default = true
description = "Configure CPU throttling outside of request processing."
}
variable cpus {
type = number
default = 1
description = "Number of CPUs to allocate per container."
}
variable entrypoint {
type = list(string)
default = []
description = "Entrypoint command. Defaults to the image's ENTRYPOINT if not provided."
}
variable env {
type = set(
object({
key = string,
value = optional(string),
secret = optional(string),
version = optional(string),
})
)
default = []
description = "Environment variables to inject into container instances."
validation {
error_message = "Environment variables must have one of `value` or `secret` defined."
condition = alltrue([
length([for e in var.env: e if (e.value == null && e.secret == null)]) < 1,
length([for e in var.env: e if (e.value != null && e.secret != null)]) < 1,
])
}
}
variable execution_environment {
type = string
default = "gen1"
description = "Execution environment to run container instances under."
}
variable http2 {
type = bool
default = false
description = "Enable use of HTTP/2 end-to-end."
}
variable ingress {
type = string
default = "all"
description = "Ingress settings for the service. Allowed values: [`\"all\"`, `\"internal\"`, `\"internal-and-cloud-load-balancing\"`]"
validation {
error_message = "Ingress must be one of: [\"all\", \"internal\", \"internal-and-cloud-load-balancing\"]."
condition = contains(["all", "internal", "internal-and-cloud-load-balancing"], var.ingress)
}
}
variable labels {
type = map(string)
default = {}
description = "Labels to apply to the service."
}
variable map_domains {
type = set(string)
default = []
description = "Domain names to map to the service."
}
variable max_instances {
type = number
default = 1000
description = "Maximum number of container instances allowed to start."
}
variable memory {
type = number
default = 256
description = "Memory (in Mi) to allocate to containers. Minimum of 512Mi is required when `execution_environment` is `\"gen2\"`."
}
variable min_instances {
type = number
default = 0
description = "Minimum number of container instances to keep running."
}
variable port {
type = number
default = 8080
description = "Port on which the container is listening for incoming HTTP requests."
}
variable project {
type = string
default = null
description = "Google Cloud project in which to create resources."
}
variable revision {
type = string
default = null
description = "Revision name to use. When `null`, revision names are automatically generated."
}
variable service_account_email {
type = string
default = null
description = "IAM service account email to assign to container instances."
}
variable timeout {
type = number
default = 60
description = "Maximum duration (in seconds) allowed for responding to requests."
}
variable volumes {
type = set(object({ path = string, secret = string, versions = optional(map(string)) }))
default = []
description = "Volumes to be mounted & populated from secrets."
validation {
error_message = "Multiple volumes for the same path can't be defined."
condition = length(tolist(var.volumes.*.path)) == length(toset(var.volumes.*.path))
}
}
variable vpc_access {
type = object({ connector = optional(string), egress = optional(string) })
default = { connector = null, egress = null }
description = "Control VPC access for the service."
validation {
error_message = "VPC access egress must be one of the following values: [\"all-traffic\", \"private-ranges-only\"]."
condition = var.vpc_access.connector == null || var.vpc_access.egress == null || contains(["all-traffic", "private-ranges-only"], coalesce(var.vpc_access.egress, "private-ranges-only"))
}
}
variable vpc_connector_name {
type = string
default = null
description = "VPC connector to apply to this service (Deprecated - use `var.vpc_access.connector` instead)."
}
variable vpc_access_egress {
type = string
default = "private-ranges-only"
description = "Specify whether to divert all outbound traffic through the VPC, or private ranges only (Deprecated - use `var.vpc_access.egress` instead)."
}