-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathvariables.tf
More file actions
100 lines (88 loc) · 3.59 KB
/
Copy pathvariables.tf
File metadata and controls
100 lines (88 loc) · 3.59 KB
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
variable "sumologic_environment" {
type = string
description = "Enter au, ca, de, eu, jp, us2, kr, fed ch or us1. For more information on Sumo Logic deployments visit https://help.sumologic.com/APIs/General-API-Information/Sumo-Logic-Endpoints-and-Firewall-Security"
validation {
condition = contains([
"stag",
"long",
"au",
"ca",
"de",
"eu",
"jp",
"us1",
"us2",
"kr",
"fed",
"ch"
], var.sumologic_environment)
error_message = "The value must be one of au, ca, de, eu, jp, us1, us2, kr, ch or fed."
}
}
variable "sumologic_environment_base_url" {
type = string
description = "Base URL for custom Sumo Logic environments (e.g., 'https://api.ch.sumologic.com/api/' for Switzerland). If provided, this takes precedence over the sumologic_environment parameter. Leave empty for standard deployments."
default = null
validation {
condition = var.sumologic_environment_base_url == null || can(regex("^https://[a-zA-Z0-9.-]+\\.sumologic\\.(com|net)/api/?$", var.sumologic_environment_base_url))
error_message = "The base URL must be null or a valid Sumo Logic API endpoint URL (e.g., 'https://api.ch.sumologic.com/api/' or 'https://stag-api.sumologic.net/api/')."
}
}
variable "sumologic_access_id" {
type = string
description = "Sumo Logic Access ID. Visit https://help.sumologic.com/Manage/Security/Access-Keys#Create_an_access_key"
validation {
condition = can(regex("\\w+", var.sumologic_access_id))
error_message = "The SumoLogic access ID must contain valid characters."
}
}
variable "sumologic_access_key" {
type = string
description = "Sumo Logic Access Key. Visit https://help.sumologic.com/Manage/Security/Access-Keys#Create_an_access_key"
sensitive = true
validation {
condition = can(regex("\\w+", var.sumologic_access_key))
error_message = "The SumoLogic access key must contain valid characters."
}
}
variable "installation_apps_list" {
description = "List of Sumo Logic apps to be installed. Each app can have custom parameters specific to that app."
type = list(object({
uuid = string
name = string
version = string
parameters = optional(map(string), {})
}))
default = []
validation {
condition = length(var.installation_apps_list) == 0 || alltrue([
for app in var.installation_apps_list :
can(regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$", app.uuid))
])
error_message = "All UUIDs must be in valid UUID format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."
}
validation {
condition = length(var.installation_apps_list) == 0 || alltrue([
for app in var.installation_apps_list :
length(app.name) > 0 && length(app.name) <= 100
])
error_message = "App names must not be empty and must be 100 characters or less."
}
validation {
condition = length(var.installation_apps_list) == 0 || alltrue([
for app in var.installation_apps_list :
app.version == "latest" || can(regex("^[0-9]+\\.[0-9]+\\.[0-9]+$", app.version))
])
error_message = "App versions must be either 'latest' or in semantic version format (x.y.z)."
}
validation {
condition = length(var.installation_apps_list) == 0 || alltrue([
for app in var.installation_apps_list :
alltrue([
for key, value in app.parameters :
length(key) > 0 && length(key) <= 128 && length(value) <= 1024
])
])
error_message = "Parameter keys must be between 1-128 characters and values must be 1024 characters or less."
}
}