forked from terraform-google-modules/terraform-google-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
243 lines (212 loc) · 7.35 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
/**
* Copyright 2019 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.
*/
// This file was automatically generated from a template in ./autogen
variable "project_id" {
type = string
description = "The GCP project ID"
default = null
}
variable "hostname" {
description = "Hostname prefix for instances"
default = "default"
}
variable "mig_name" {
type = string
description = "Managed instance group name. When variable is empty, name will be derived from var.hostname."
default = ""
}
variable "region" {
description = "The GCP region where the managed instance group resides."
}
variable "instance_template" {
description = "Instance template self_link used to create compute instances"
}
variable "target_size" {
description = "The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set."
default = 1
}
variable "target_pools" {
description = "The target load balancing pools to assign this group to."
type = list(string)
default = []
}
variable "distribution_policy_zones" {
description = "The distribution policy, i.e. which zone(s) should instances be create in. Default is all zones in given region."
type = list(string)
default = []
}
#################
# Stateful disks
#################
variable "stateful_disks" {
description = "Disks created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs"
type = list(object({
device_name = string
delete_rule = string
}))
default = []
}
#################
# Rolling Update
#################
variable "update_policy" {
description = "The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager.html#rolling_update_policy"
type = list(object({
max_surge_fixed = number
instance_redistribution_type = string
max_surge_percent = number
max_unavailable_fixed = number
max_unavailable_percent = number
min_ready_sec = number
replacement_method = string
minimal_action = string
type = string
}))
default = []
}
##############
# Healthcheck
##############
variable "health_check_name" {
type = string
description = "Health check name. When variable is empty, name will be derived from var.hostname."
default = ""
}
variable "health_check" {
description = "Health check to determine whether instances are responsive and able to do work"
type = object({
type = string
initial_delay_sec = number
check_interval_sec = number
healthy_threshold = number
timeout_sec = number
unhealthy_threshold = number
response = string
proxy_header = string
port = number
request = string
request_path = string
host = string
})
default = {
type = ""
initial_delay_sec = 30
check_interval_sec = 30
healthy_threshold = 1
timeout_sec = 10
unhealthy_threshold = 5
response = ""
proxy_header = "NONE"
port = 80
request = ""
request_path = "/"
host = ""
}
}
#############
# Autoscaler
#############
variable "autoscaler_name" {
type = string
description = "Autoscaler name. When variable is empty, name will be derived from var.hostname."
default = ""
}
variable "autoscaling_enabled" {
description = "Creates an autoscaler for the managed instance group"
default = "false"
}
variable "max_replicas" {
description = "The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas."
default = 10
}
variable "min_replicas" {
description = "The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0."
default = 2
}
variable "cooldown_period" {
description = "The number of seconds that the autoscaler should wait before it starts collecting information from a new instance."
default = 60
}
variable "autoscaling_cpu" {
description = "Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#cpu_utilization"
type = list(map(number))
default = []
}
variable "autoscaling_metric" {
description = "Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#metric"
type = list(object({
name = string
target = number
type = string
}))
default = []
}
variable "autoscaling_lb" {
description = "Autoscaling, load balancing utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#load_balancing_utilization"
type = list(map(number))
default = []
}
variable "autoscaling_scale_in_control" {
description = "Autoscaling, scale-in control block. https://www.terraform.io/docs/providers/google/r/compute_autoscaler.html#scale_in_control"
type = object({
fixed_replicas = number
percent_replicas = number
time_window_sec = number
})
default = {
fixed_replicas = null
percent_replicas = null
time_window_sec = null
}
}
##########################
variable "network" {
description = "Network to deploy to. Only one of network or subnetwork should be specified."
default = ""
}
variable "subnetwork" {
description = "Subnet to deploy to. Only one of network or subnetwork should be specified."
default = ""
}
variable "subnetwork_project" {
description = "The project that subnetwork belongs to"
default = ""
}
variable "named_ports" {
description = "Named name and named port. https://cloud.google.com/load-balancing/docs/backend-service#named_ports"
type = list(object({
name = string
port = number
}))
default = []
}
variable "wait_for_instances" {
description = "Whether to wait for all instances to be created/updated before returning. Note that if this is set to true and the operation does not succeed, Terraform will continue trying until it times out."
default = "false"
}
variable "mig_timeouts" {
description = "Times for creation, deleting and updating the MIG resources. Can be helpful when using wait_for_instances to allow a longer VM startup time. "
type = object({
create = string
update = string
delete = string
})
default = {
create = "5m"
update = "5m"
delete = "15m"
}
}