-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
278 lines (243 loc) · 7.39 KB
/
variables.tf
File metadata and controls
278 lines (243 loc) · 7.39 KB
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
variable "application_name" {
description = "The name of the deployment"
type = string
}
variable "expose_as_web_service" {
description = "Indicates if the deployment should be exposed as a web service"
type = bool
default = true
}
variable "application_version" {
description = "The version of the deployment. Ideally this is an Autotagged Semver, but we could use the Github run id."
type = string
}
variable "container_image" {
description = "The container image to deploy"
type = string
}
variable "container_port" {
description = "The port the container exposes"
type = number
default = 8080
}
variable "host_alias" {
description = "The host aliases to apply to the deployment"
type = object({
hostnames = list(string)
ip = string
})
default = null
}
variable "labels" {
description = "The labels to apply to the deployment"
type = map(string)
default = {}
}
variable "namespace" {
description = "The Kubernetes namespace where the deployment will be created"
type = string
default = "internal"
}
variable "team" {
description = "The team that owns the deployment"
type = string
}
variable "wait_for_rollout" {
description = "Wait for the rollout of the deployment to complete."
type = bool
default = true
}
variable "liveness_probe" {
description = "Configuration for liveness probe"
type = object({
path = optional(string)
port = optional(number)
initial_delay_seconds = optional(number)
period_seconds = optional(number)
timeout_seconds = optional(number)
failure_threshold = optional(number)
success_threshold = optional(number)
})
default = {
path = "/livez"
port = 8080 # Added this default
initial_delay_seconds = 10
period_seconds = 10
timeout_seconds = 2
failure_threshold = 3
success_threshold = 1
}
}
variable "readiness_probe" {
description = "Configuration for readiness probe"
type = object({
path = optional(string)
port = optional(number)
initial_delay_seconds = optional(number)
period_seconds = optional(number)
timeout_seconds = optional(number)
failure_threshold = optional(number)
success_threshold = optional(number)
})
default = {
path = "/readyz"
port = 8080 # Added this default
initial_delay_seconds = 10
period_seconds = 10
timeout_seconds = 2
failure_threshold = 3
success_threshold = 1
}
}
variable "topology_spread" {
description = "Configuration for topology spread"
type = object({
max_skew = optional(number)
topology_key = optional(string)
when_unsatisfiable = optional(string)
})
default = {
max_skew = 1
topology_key = "kubernetes.io/hostname"
when_unsatisfiable = "ScheduleAnyway"
}
}
variable "resources" {
description = "Resource requests and limits"
type = object({
requests = object({
cpu = string
memory = string
})
limits = object({
cpu = string
memory = string
})
})
default = {
requests = {
memory = "64Mi"
cpu = "250m"
}
limits = {
memory = "128Mi"
cpu = "500m"
}
}
}
variable "env_vars" {
description = "List of environment variables for the deployment"
type = map(any)
default = {}
}
variable "secret_env_vars" {
description = "List of environment that are set as secret variables for the deployment. These are stored in K8s and not in GSM"
type = map(any)
default = {}
}
variable "min_replicas" {
description = "Minimum number of replicas for the deployment"
type = number
default = 3
}
variable "max_replicas" {
description = "Maximum number of replicas for the deployment"
type = number
default = 5
}
variable "max_surge" {
description = "Maximum number of pods that can be scheduled above the desired number of pods."
type = string
default = "25%"
}
variable "max_unavailable" {
description = "Maximum number of pods that can be unavailable during the update"
type = string
default = "25%"
}
variable "autoscaler" {
description = "Configuration for the autoscaler"
type = object({
cpu_utilization = optional(number)
memory_utilization = optional(number)
# External Metrics. Example: Google Pubsub
external_metric = optional(object({
metric_name = string
target_value = string
selector_labels = optional(map(string))
}))
})
default = {
cpu_utilization = 80 # This implies 80%
}
}
variable "deployment_service_type" {
description = "The type of service to create for the deployment"
type = string
default = "ClusterIP"
}
variable "roles" {
description = "The IAM roles to apply to the service account for the deployment. Only used when workload identity is enabled."
type = list(string)
default = []
}
variable "project" {
description = "The GCP project ID. Required when using workload identity."
type = string
default = null
}
variable "gke_cluster_name" {
description = "The name of the GKE cluster. Required when using workload identity."
type = string
default = null
}
variable "service_account_name" {
description = "The name of the service account to use for workload identity. If not provided, defaults to '{application_name}-sa'."
type = string
default = null
}
variable "node_pool" {
description = "List of target GKE node pool labels (e.g., preemptive32, standard4)."
type = list(string)
default = []
}
variable "observability_config" {
description = "Configuration for observability integrations (e.g., Datadog). Set to null to disable."
type = object({
agent_host_env_vars = optional(list(string), ["DD_AGENT_HOST", "DD_TRACE_AGENT_HOSTNAME"])
service_name_prefix = optional(string, "")
service_env_var = optional(string, "DD_SERVICE")
version_env_var = optional(string, "DD_VERSION")
})
default = null
}
variable "enable_neg_annotation" {
description = "Enable Google Cloud NEG (Network Endpoint Group) annotation on the service"
type = bool
default = false
}
variable "gcp_service_account_description" {
description = "Description for the GCP service account created by workload identity"
type = string
default = null
}
variable "automount_service_account_token" {
description = "Whether to automount the service account token in pods. Set to false for enhanced security when using workload identity."
type = bool
default = true
}
variable "use_existing_gcp_sa" {
description = "Use an existing GCP service account instead of creating a new one. Provide the email in 'existing_gcp_sa_email'."
type = bool
default = false
}
variable "existing_gcp_sa_email" {
description = "Email of existing GCP service account to use with workload identity (when use_existing_gcp_sa is true)"
type = string
default = null
}
variable "gke_location" {
description = "The location (region or zone) of the GKE cluster. Used for regional/zonal workload identity configuration."
type = string
default = null
}