forked from EnterpriseDB/edb-terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variables.tf
259 lines (252 loc) · 8.47 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
variable "spec" {
description = <<-EOT
Object meant to represent inputs needed to get a valid configuration
for use with the rest of the cloud provider module collection.
In most cases:
* optional() should be used so that null is passed further down for the module to handle
* Module require null to be handled:
* set a default if desired: optional(type,default)
* Need to set a default after the initial object is set:
* dynamically set variables with the use of locals and null_resource
* set an output variable for use with other modules
* sibling modules should handle most errors with variable validations and preconditions
so they are caught during terraform plan
* provider implementations vary and errors might need to be caught eariler, as last resort,
use validations and preconditions here for use with terraform plan or postconditions with terraform apply
EOT
type = object({
# Project Level Tags to be merged with other tags
tags = optional(map(string), {
cluster_name = "AWS-Cluster-default"
created_by = "EDB-Terraform-AWS"
})
ssh_key = optional(object({
public_path = optional(string)
private_path = optional(string)
output_name = optional(string, "ssh-id_rsa")
use_agent = optional(bool, false)
}), {})
images = optional(map(object({
name = optional(string)
owner = optional(string)
ssh_user = optional(string)
})))
regions = map(object({
cidr_block = string
zones = optional(map(object({
zone = optional(string)
cidr = optional(string)
})), {})
ports = optional(list(object({
defaults = optional(string, "")
port = optional(number)
to_port = optional(number)
protocol = string
description = optional(string, "default")
type = optional(string, "ingress")
cidrs = optional(list(string), [])
})), [])
}))
machines = optional(map(object({
type = optional(string)
image_name = string
count = optional(number, 1)
spot = optional(bool)
region = string
ssh_port = optional(number, 22)
ports = optional(list(object({
defaults = optional(string, "")
port = optional(number)
to_port = optional(number)
protocol = string
description = optional(string, "default")
type = optional(string, "ingress")
cidrs = optional(list(string), [])
})), []
)
zone_name = string
instance_type = string
volume = object({
type = string
size_gb = number
iops = optional(number)
encrypted = optional(bool)
})
# Some cloud instances come with pre-attached storage.
# Creates an lvm group from the storage and creates any logical volumes for the mount points.
preattached_volumes = optional(object({
required = optional(bool)
volume_group = optional(string)
mount_points = optional(map(object({
size = optional(string)
filesystem = optional(string)
mount_options = optional(string)
})))
}), {})
# Creates a set of volumes around a machine instance to be attached post-terraform
jbod_volumes = optional(map(object({
type = string
size_gb = number
iops = optional(number)
throughput = optional(number)
encrypted = optional(bool)
})))
# Cloud providers may:
# * change order of volume attachment during reboot/stop
# * mount location can be ignored based on type
# * initial mount location can be set by the instance image
# To track volumes, pre-formating is required to create a UUID on the volume.
# Use jbod_volumes which are meant to represent "Just a bunch of Disks(Volumes)" as an alternative
# to manually manage per machine instance post-terraform
additional_volumes = optional(list(object({
count = optional(number, 1)
mount_point = optional(string)
size_gb = number
iops = optional(number)
throughput = optional(number)
type = string
encrypted = optional(bool)
filesystem = optional(string)
mount_options = optional(string)
volume_group = optional(string)
})), [])
volume_groups = optional(map(map(object({
size = optional(string)
filesystem = optional(string)
mount_options = optional(string)
}))), {})
tags = optional(map(string), {})
})), {})
databases = optional(map(object({
region = string
engine = string
engine_version = number
instance_type = string
dbname = string
username = string
password = string
port = number
volume = object({
size_gb = number
type = string
iops = number
encrypted = bool
})
settings = optional(list(object({
name = string
value = number
})), [])
tags = optional(map(string), {})
})), {})
aurora = optional(map(object({
region = string
zones = list(string)
count = number
engine = string
engine_version = number
instance_type = string
dbname = string
username = string
password = string
port = number
settings = optional(list(object({
name = string
value = string
})), [])
tags = optional(map(string), {})
})), {})
biganimal = optional(map(object({
project = optional(object({
id = optional(string)
}), {})
password = optional(string)
image = optional(object({
pg = optional(string)
proxy = optional(string)
}), {})
data_groups = optional(map(object({
cloud_account = optional(bool)
type = string
region = string
node_count = number
engine = string
engine_version = number
instance_type = string
volume = object({
size_gb = number
type = string
properties = string
iops = optional(number)
throughput = optional(number)
})
wal_volume = optional(object({
size_gb = number
type = string
properties = string
iops = optional(number)
throughput = optional(number)
}))
pgvector = optional(bool)
settings = optional(list(object({
name = string
value = string
})), [])
allowed_ip_ranges = optional(list(object({
cidr_block = string
description = optional(string, "default description")
})))
allowed_machines = optional(list(string))
})))
witness_groups = optional(map(object({
region = string
cloud_account = optional(bool)
cloud_service_provider = string
})), {})
tags = optional(map(string), {})
})), {})
kubernetes = optional(map(object({
region = string
node_count = number
instance_type = string
tags = optional(map(string), {})
})), {})
})
}
variable "force_ssh_access" {
description = "Force append a service rule for ssh access"
default = false
type = bool
nullable = false
}
variable "ba_project_id_default" {
description = "BigAnimal project ID"
type = string
nullable = true
}
variable "ba_cloud_account_default" {
description = "BigAnimal cloud account default"
type = string
nullable = true
}
variable "ba_pg_image_default" {
description = "Dev only: BigAnimal postgres image to use if not defined within the biganimal configuration"
type = string
nullable = true
default = null
}
variable "ba_proxy_image_default" {
description = "Dev only: BigAnimal proxy image to use if not defined within the biganimal configuration"
type = string
nullable = true
default = null
}
variable "ba_ignore_image_default" {
description = "Ignore biganimal custom images"
type = bool
nullable = false
default = false
}
locals {
cluster_name = can(var.spec.tags.cluster_name) ? var.spec.tags.cluster_name : "AWS-Cluster-default"
created_by = can(var.spec.tags.created_by) ? var.spec.tags.created_by : "EDB-Terraform-AWS"
}