forked from claranet/terraform-azurerm-db-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.tf
More file actions
285 lines (246 loc) · 9.75 KB
/
Copy pathvariables.tf
File metadata and controls
285 lines (246 loc) · 9.75 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
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
variable "location" {
description = "Azure location."
type = string
}
variable "location_short" {
description = "Short string for Azure location."
type = string
}
variable "client_name" {
description = "Client name/account used in naming."
type = string
}
variable "environment" {
description = "Project environment."
type = string
}
variable "stack" {
description = "Project stack name."
type = string
}
variable "resource_group_name" {
description = "Resource group name."
type = string
}
variable "server_version" {
description = "Version of the SQL Server. Valid values are: 2.0 (for v11 server) and 12.0 (for v12 server). See [documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_server#version-1)."
type = string
default = "12.0"
}
variable "allowed_cidrs" {
description = "List/map of allowed CIDR ranges to access the SQL server. Default to all Azure services."
type = any
nullable = false
default = { azure-services = "0.0.0.0/32" }
validation {
condition = can(tomap(var.allowed_cidrs)) || can(tolist(var.allowed_cidrs))
error_message = "The `allowed_cidrs` argument must either be list(string) or map(string) of CIDRs."
}
}
variable "elastic_pool_enabled" {
description = "True to deploy the databases in an ElasticPool, single databases are deployed otherwise."
type = bool
default = false
}
variable "elastic_pool_sku" {
description = <<DESC
SKU for the Elastic Pool with tier and eDTUs capacity. Premium tier with zone redundancy is mandatory for high availability.
Possible values for tier are `GeneralPurpose`, `BusinessCritical` for vCore models and `Basic`, `Standard`, or `Premium` for DTU based models.
See [documentation](https://learn.microsoft.com/en-us/azure/azure-sql/database/resource-limits-dtu-elastic-pools?view=azuresql)."
DESC
type = object({
tier = string,
capacity = number,
family = optional(string, "Gen5")
})
default = null
validation {
condition = try(contains(["GeneralPurpose", "BusinessCritical", "Basic", "Standard", "Premium", "Hyperscale"], var.elastic_pool_sku.tier), true)
error_message = "`var.elastic_pool_sku.tier` possible values are `GeneralPurpose`, `BusinessCritical`, `Hyperscale` for vCore models and `Basic`, `Standard`, or `Premium` for DTU based models."
}
validation {
condition = try(contains(["Gen5", "Fsv2", "DC"], var.elastic_pool_sku.family), true)
error_message = "`var.elastic_pool_sku.family` possible values are `Gen5`, `Fsv2` or `DC`."
}
}
variable "elastic_pool_license_type" {
description = "Specifies the license type applied to this database. Possible values are `LicenseIncluded` and `BasePrice`."
type = string
default = null
}
variable "elastic_pool_max_size" {
description = "Maximum size of the Elastic Pool in gigabytes."
type = string
default = null
}
variable "elastic_pool_zone_redundant" {
description = "True to have the Elastic Pool zone redundant, SKU tier must be Premium to use it. This is mandatory for high availability."
type = bool
default = false
}
variable "elastic_pool_databases_min_capacity" {
description = "The minimum capacity (DTU or vCore) all databases are guaranteed in the Elastic Pool. Defaults to 0."
type = number
default = 0
}
variable "elastic_pool_databases_max_capacity" {
description = "The maximum capacity (DTU or vCore) any one database can consume in the Elastic Pool. Default to the max Elastic Pool capacity."
type = number
default = null
}
variable "administrator_login" {
description = "Administrator login for SQL Server."
type = string
}
variable "administrator_password" {
description = "Administrator password for SQL Server."
type = string
}
variable "single_databases_sku_name" {
description = "Specifies the name of the SKU used by the database. For example, `GP_S_Gen5_2`, `HS_Gen4_1`, `BC_Gen5_2`. Use only if `elastic_pool_enabled` variable is set to `false`. More documentation [here](https://docs.microsoft.com/en-us/azure/azure-sql/database/service-tiers-general-purpose-business-critical)"
type = string
default = "GP_Gen5_2"
}
variable "create_databases_users" {
description = "True to create a user named <db>_user on each database with generated password and role db_owner."
type = bool
default = true
}
variable "allowed_subnets_ids" {
description = "List of Subnet ID to allow to connect to the SQL Instance."
type = list(string)
default = []
}
variable "custom_users" {
description = <<DESC
List of objects for custom users creation.
Password are generated.
These users are created within the "custom_users" submodule.
DESC
type = list(object({
name = string
database = string
roles = optional(list(string))
}))
default = []
}
variable "databases" {
description = "List of the databases configurations for this server."
type = list(object({
name = string
license_type = optional(string)
sku_name = optional(string)
identity_ids = optional(list(string), [])
max_size_gb = optional(number)
create_mode = optional(string)
min_capacity = optional(number)
auto_pause_delay_in_minutes = optional(number)
read_scale = optional(string)
read_replica_count = optional(number)
creation_source_database_id = optional(string)
restore_point_in_time = optional(string)
recover_database_id = optional(string)
restore_dropped_database_id = optional(string)
collation = optional(string)
storage_account_type = optional(string, "Geo")
database_extra_tags = optional(map(string), {})
}))
default = []
}
variable "backup_retention" {
description = "Definition of long term backup retention for all the databases in this SQL Server."
type = object({
weekly_retention = optional(number)
monthly_retention = optional(number)
yearly_retention = optional(number)
week_of_year = optional(number)
})
default = {}
}
variable "tls_minimum_version" {
description = "The TLS minimum version for all SQL Database associated with the server. Valid values are: `1.0`, `1.1` and `1.2`."
type = string
default = "1.2"
}
variable "public_network_access_enabled" {
description = "True to allow public network access for this server."
type = bool
default = false
}
variable "outbound_network_restriction_enabled" {
description = "Whether outbound network traffic is restricted for this server."
type = bool
default = false
}
variable "azuread_administrator" {
description = "Azure AD Administrator configuration block of this SQL Server."
type = object({
login_username = optional(string)
object_id = optional(string)
tenant_id = optional(string)
azuread_authentication_only = optional(bool)
})
default = null
}
variable "connection_policy" {
description = "The connection policy the server will use. Possible values are `Default`, `Proxy`, and `Redirect`."
type = string
default = "Default"
}
variable "databases_collation" {
description = "SQL Collation for the databases."
type = string
default = "SQL_Latin1_General_CP1_CI_AS"
}
variable "databases_zone_redundant" {
description = "True to have databases zone redundant, which means the replicas of the databases will be spread across multiple availability zones. This property is only settable for `Premium` and `Business Critical` databases."
type = bool
default = null
}
variable "point_in_time_restore_retention_days" {
description = "Point In Time Restore configuration. Value has to be between `7` and `35`."
type = number
default = 7
validation {
condition = var.point_in_time_restore_retention_days >= 7 && var.point_in_time_restore_retention_days <= 35
error_message = "The PITR retention should be between 7 and 35 days."
}
}
variable "point_in_time_backup_interval_in_hours" {
description = "The hours between each differential backup. This is only applicable to live databases but not dropped databases. Value has to be 12 or 24. Defaults to 12 hours."
type = number
default = 12
validation {
condition = var.point_in_time_backup_interval_in_hours == 12 || var.point_in_time_backup_interval_in_hours == 24
error_message = "The PITR retention should be 12 or 24 hours."
}
}
variable "security_storage_account_blob_endpoint" {
description = "Storage Account blob endpoint used to store security logs and reports."
type = string
default = null
}
variable "security_storage_account_access_key" {
description = "Storage Account access key used to store security logs and reports."
type = string
default = null
}
variable "security_storage_account_container_name" {
description = "Storage Account container name where to store SQL Server vulnerability assessment."
type = string
default = null
}
variable "identity" {
description = "Identity block information."
type = object({
type = optional(string, "SystemAssigned")
identity_ids = optional(list(string))
})
default = {}
nullable = false
}
variable "primary_user_assigned_identity_id" {
description = "Specifies the primary user managed identity id. Required if type within the identity block is set to either SystemAssigned, UserAssigned or UserAssigned and should be set at same time as setting identity_ids."
type = string
default = null
}