-
Notifications
You must be signed in to change notification settings - Fork 7
/
variables.tf
165 lines (163 loc) · 5.29 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
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)
})), {})
service_ports = optional(list(object({
port = optional(number)
protocol = string
description = optional(string)
type = optional(string, "ingress")
cidrs = optional(list(string), ["0.0.0.0/0"])
})), [])
region_ports = optional(list(object({
port = optional(number)
protocol = string
description = optional(string)
type = optional(string, "ingress")
cidrs = optional(list(string))
})), [])
}))
machines = optional(map(object({
type = optional(string)
image_name = string
count = optional(number, 1)
region = string
ssh_port = optional(number, 22)
ports = optional(list(object({
port = optional(number)
protocol = string
description = optional(string)
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)
})
additional_volumes = optional(list(object({
mount_point = string
size_gb = number
iops = optional(number)
type = string
encrypted = optional(bool)
})), [])
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({
type = string
project = object({
id = optional(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)
})
password = string
settings = optional(list(object({
name = string
value = string
})), [])
allowed_ip_ranges = optional(list(object({
cidr_block = string
description = optional(string, "default description")
})))
tags = optional(map(string), {})
})), {})
kubernetes = optional(map(object({
region = string
node_count = number
instance_type = string
tags = optional(map(string), {})
})), {})
})
}
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"
}