-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
134 lines (114 loc) · 4.03 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
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
variable "logical_product_family" {
type = string
description = <<EOF
(Required) Name of the product family for which the resource is created.
Example: org_name, department_name.
EOF
nullable = false
validation {
condition = can(regex("^[_\\-A-Za-z0-9]+$", var.logical_product_family))
error_message = "The variable must contain letters, numbers, -, _, and .."
}
}
variable "logical_product_service" {
type = string
description = <<EOF
(Required) Name of the product service for which the resource is created.
For example, backend, frontend, middleware etc.
EOF
nullable = false
validation {
condition = can(regex("^[_\\-A-Za-z0-9]+$", var.logical_product_service))
error_message = "The variable must contain letters, numbers, -, _, and .."
}
}
variable "region" {
type = string
description = <<EOF
(Required) The location where the resource will be created. Must not have spaces
For example, us-east-2, useast2, West-US-2
EOF
nullable = false
validation {
condition = length(regexall("\\b \\b", var.region)) == 0
error_message = "Spaces between the words are not allowed."
}
}
variable "class_env" {
type = string
description = "(Required) Environment where resource is going to be deployed. For example. dev, qa, uat"
nullable = false
validation {
condition = length(regexall("\\b \\b", var.class_env)) == 0
error_message = "Spaces between the words are not allowed."
}
}
variable "instance_env" {
type = number
description = "Number that represents the instance of the environment."
default = 0
validation {
condition = var.instance_env >= 0 && var.instance_env <= 999
error_message = "Instance number should be between 1 to 999."
}
}
variable "cloud_resource_type" {
type = string
description = "(Required) Abbreviation for the type of resource. For ex. 'rg' for Azure Resource group."
nullable = false
validation {
condition = length(regexall("\\b \\b", var.cloud_resource_type)) == 0
error_message = "Spaces between the words are not allowed."
}
validation {
condition = can(regex("^[A-Za-z0-9]+$", var.cloud_resource_type))
error_message = "The variable must contain letters and numbers."
}
}
variable "instance_resource" {
type = number
description = "Number that represents the instance of the resource."
default = 0
validation {
condition = var.instance_resource >= 0 && var.instance_resource <= 100
error_message = "Instance number should be between 1 to 100."
}
}
variable "maximum_length" {
type = number
description = "Number that represents the maximum length the resource name could have."
default = 60
validation {
condition = var.maximum_length >= 10 && var.maximum_length <= 512
error_message = "Maximum length number should be between 24 to 512."
}
}
variable "separator" {
type = string
description = "Separator to be used in the name"
default = "-"
validation {
condition = length(trimspace(var.separator)) == 1
error_message = "Length of the separator must be 1 character."
}
validation {
condition = length(regexall("[._-]", var.separator)) > 0
error_message = "Only '.', '_', '-' are allowed as separator."
}
}
variable "use_azure_region_abbr" {
description = "Whether to use Azure region abbreviation e.g. eastus -> eus"
type = bool
default = false
}