-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
214 lines (189 loc) · 7.06 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 "name" {
description = "Name of the application. Must be unique on Scalingo."
type = string
}
variable "stack" {
description = "The stack to use for the app (default: \"scalingo-22\")."
type = string
default = "scalingo-22"
validation {
condition = contains(["scalingo-18", "scalingo-20", "scalingo-22"], var.stack)
error_message = "The stack value must be one of the following: scalingo-18, scalingo-20, scalingo-22"
}
}
variable "containers" {
description = "Configuration of the containers of the application."
type = map(object({
size = optional(string, "S")
amount = optional(number, 1)
autoscaler = optional(object({
min_containers = optional(number, 2)
max_containers = optional(number, 10)
metric = optional(string, "cpu")
target = optional(number, 0.8)
}))
}))
default = { web = { size = "S", amount = 0 } }
nullable = false
}
variable "authorize_unsecure_http" {
description = "When true, Scalingo does not automatically redirect HTTP traffic to HTTPS. The default behavior is to redirect HTTP traffic to HTTPS (when value is `false`)"
type = bool
default = false
nullable = false
}
variable "router_logs" {
description = "When true, the router logs are included in the application logs. (default: `false`)"
type = bool
default = false
nullable = false
}
variable "sticky_session" {
description = "When true, sticky sessions are enabled. (default: `false`)"
type = bool
default = false
nullable = false
}
variable "github_integration" {
description = "Configuration of the GitHub integration of the application. Only one of github_integration or gitlab_integration can be set."
type = object({
repo_url = string
integration_uuid = optional(string)
branch = optional(string, "main")
auto_deploy_enabled = optional(bool, true)
})
default = null
}
variable "gitlab_integration" {
description = "Configuration of the GitLab integration of the application. Only one of github_integration or gitlab_integration can be set."
type = object({
repo_url = string
integration_uuid = optional(string)
branch = optional(string, "main")
auto_deploy_enabled = optional(bool, true)
})
default = null
}
variable "review_apps" {
description = "Configuration of the review apps of the application."
type = object({
enabled = optional(bool, false)
# By default: delete review apps 0 hours after closing the PR
delete_on_close_enabled = optional(bool, true)
hours_before_delete_on_close = optional(string, "0")
# By default: delete review apps after 5 days of inactivity (= no new deployment)
delete_stale_enabled = optional(bool, true)
hours_before_delete_stale = optional(string, "168")
# By default: do not create review apps for PRs from forks
automatic_creation_from_forks_allowed = optional(bool, false)
})
default = {}
}
variable "additionnal_collaborators" {
description = "List of emails of collaborators that have admin rights for the application"
type = list(string)
default = []
nullable = false
# validate that the list contains only valid emails
validation {
condition = length([
for email in var.additionnal_collaborators :
email if regex("^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$", email) == false
]) == 0
error_message = "The list of emails must contain only valid emails."
}
}
variable "environment" {
description = "Map of environment variables to set on the application. Note that value of environment variables can be null or empty."
type = map(string)
default = null
# validate that the map does not contain any null and empty values
validation {
condition = length([
for key, value in var.environment :
key if value == null || value == ""
]) == 0
error_message = "The map of environment variables must not contain any null or empty values."
}
}
variable "addons" {
description = "List of addons to add to the application"
type = list(object({
provider = string
plan = string
database_features = optional(list(string))
}))
default = []
nullable = false
}
# TODO: implement notifier and alert
#
# variable "notifications" {
# type = list(object({
# name = string
# type = string
# active = optional(bool, true)
# emails = optional(list(string), [])
# send_all_alerts = optional(bool, false)
# send_all_events = optional(bool, false)
# events = optional(list(string), [])
# webhook_url = optional(string, "")
# container_alerts = object({
# limit = optional(number, 0.8)
# metric = optional(string, "cpu")
# duration_before_trigger = optional(string)
# })
# }))
# default = []
# nullable = false
# }
variable "domain" {
description = "Main domain name of the application, known as \"canonical domain\" in Scalingo's dashboard. Note that SSL configuration must be completed through the dashboard."
type = string
default = null
nullable = true
validation {
condition = var.domain == null || can(length(regex("^([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$", var.domain)) > 0)
error_message = "The domain name must be a valid domain name."
}
}
variable "domain_aliases" {
description = "List of others domain names for the application"
type = list(string)
default = []
nullable = false
validation {
condition = length([
for domain in var.domain_aliases :
domain if !can(length(regex("^([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,6})$", domain)) == 0)
]) == 0
error_message = "The list of domain names must contain only valid domain names."
}
}
variable "log_drains" {
description = "List of log_drain configuration to redirect logs from the application and addons to a log management service. Each configuration is automatically associated to the application and to every eligible addons."
type = list(object({
type = string
url = optional(string, "")
drain_region = optional(string, "")
host = optional(string, "")
port = optional(string, "")
token = optional(string, "")
}))
default = []
nullable = false
validation {
condition = length([
for drain in var.log_drains :
drain if !contains(["elk", "appsignal", "logtail", "datadog", "ovh-graylog", "papertrail", "logtail", "syslog"], drain.type)
]) == 0
error_message = "The list of log drains must contain only valid log drains type (elk/appsignal/logtail/datadog/ovh-graylog/papertrail/logtail/syslog)."
}
validation {
condition = length([
for drain in var.log_drains :
drain if drain.type == "elk" && can(length(regex("^https?://([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$", drain.url)) == 0)
]) == 0
error_message = "Log drains of type \"elk\" must have a valid url."
}
}