-
Notifications
You must be signed in to change notification settings - Fork 7
/
variables.tf
214 lines (206 loc) · 6.84 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
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 = "Azure-Cluster-default"
created_by = "EDB-Terraform-Azure"
})
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({
publisher = optional(string)
offer = optional(string)
sku = optional(string)
version = optional(string)
accept = optional(bool)
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")
access = optional(string, "allow")
cidrs = optional(list(string), [])
})), [])
}))
machines = optional(map(object({
type = optional(string)
image_name = string
count = optional(number, 1)
region = string
zone_name = string
instance_type = 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")
access = optional(string, "allow")
cidrs = optional(list(string), [])
})), []
)
volume = object({
type = string
size_gb = number
})
additional_volumes = optional(list(object({
mount_point = string
size_gb = number
iops = optional(number)
type = string
filesystem = optional(string)
mount_options = optional(string)
})), [])
tags = optional(map(string), {})
})), {})
databases = optional(map(object({
region = string
zone = optional(string)
dbname = optional(string)
engine = string
engine_version = number
instance_type = string
username = string
password = string
volume = object({
size_gb = optional(number)
})
settings = optional(list(object({
name = string
value = number
})), [])
tags = optional(map(string), {})
public_access = optional(bool, false)
})), {})
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
ssh_user = optional(string)
resource_group_location = optional(string)
log_analytics_location = optional(string)
node_count = number
instance_type = string
log_analytics_sku = string
solution_name = string
publisher_name = 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 : "Azure-Cluster-default"
created_by = can(var.spec.tags.created_by) ? var.spec.tags.created_by : "EDB-Terraform-Azure"
}