-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
93 lines (83 loc) · 3.12 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
variable "friendly_name" {
type = string
description = "Friendly name to identify all resources"
default = "imperva-dsf-db-with-agent"
validation {
condition = length(var.friendly_name) >= 3
error_message = "Must be at least 3 characters long"
}
validation {
condition = can(regex("^\\p{L}.*", var.friendly_name))
error_message = "Must start with a letter"
}
}
variable "subnet_id" {
type = string
description = "Subnet id for the DSF MX instance"
validation {
condition = length(var.subnet_id) >= 15 && substr(var.subnet_id, 0, 7) == "subnet-"
error_message = "Subnet id is invalid. Must be subnet-********"
}
}
variable "key_pair" {
type = string
description = "Key pair for the ec2 instance"
}
variable "security_group_ids" {
type = list(string)
description = "AWS security group Ids to attach to the instance. If provided, no security groups are created and all allowed_*_cidrs variables are ignored."
validation {
condition = alltrue([for item in var.security_group_ids : substr(item, 0, 3) == "sg-"])
error_message = "One or more of the security group Ids list is invalid. Each item should be in the format of 'sg-xx..xxx'"
}
default = []
}
variable "allowed_ssh_cidrs" {
type = list(string)
description = "List of allowed ingress CIDR patterns allowing ssh protocols to the ec2 instance"
default = []
}
variable "db_type" {
type = string
default = null
description = "Types of databases to provision on EC2 with an Agent for simulation purposes. Available types are: 'PostgreSql', 'MySql' and 'MariaDB'. If not set, one DB type is randomly chosen."
validation {
condition = var.db_type == null || try(contains(["PostgreSql", "MySql", "MariaDB"], var.db_type), false)
error_message = "Value must be a subset of: ['PostgreSql', 'MySql', 'MariaDB']"
}
}
variable "os_type" {
type = string
default = null
description = "Os type to provision as EC2, available types are: ['Red Hat', 'Ubuntu']"
validation {
condition = var.os_type == null || try(contains(["Red Hat", "Ubuntu"], var.os_type), false)
error_message = "Valid values should contain at least one of the following: 'Red Hat', 'Ubuntu']"
}
}
variable "registration_params" {
type = object(
{
agent_gateway_host = string
secure_password = string
site = string
server_group = string
}
)
description = "Regisration parameters for DAM agent"
}
variable "binaries_location" {
type = object({
s3_bucket = string
s3_region = string
s3_prefix = string
s3_object = string
})
description = "S3 DSF DAM agent installation location. For example, { s3_bucket = 'my-bucket', s3_region = 'us-west-2', s3_prefix = 'installation-files', s3_object = 'my-file' }. This means that the path to the installation file is s3://my-bucket/installation-files/my-file. If you don't have a prefix or an object, keep them null."
nullable = false
}
variable "tags" {
description = "A map of tags to add to all resources"
type = map(string)
default = {}
}