-
Notifications
You must be signed in to change notification settings - Fork 2
/
variables.tf
324 lines (283 loc) · 16.4 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
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
variable "ID_RSA_FILE_PATH" {
default = "ansible/id_rsa"
nullable = false
description = "File path for PRIVATE_SSH_KEY. It will be automatically generated. If it is changed, it must contain the relative path from git repo folders. Example: ansible/id_rsa_java"
}
variable "PRIVATE_SSH_KEY" {
type = string
description = "id_rsa private key content in OpenSSH format (Sensitive value). This private key should be used only during the provisioning and is recommended to be changed after the SAP deployment."
}
variable "SSH_KEYS" {
type = list(string)
description = "List of SSH Keys UUIDs that are allowed to connect via SSH, as root, to the VSIs. Can contain one or more IDs. The list of SSH Keys is available here: https://cloud.ibm.com/vpc-ext/compute/sshKeys"
validation {
condition = var.SSH_KEYS == [] ? false : true && var.SSH_KEYS == [""] ? false : true
error_message = "At least one SSH KEY is needed to be able to access the VSI."
}
}
variable "BASTION_FLOATING_IP" {
type = string
description = "The BASTION FLOATING IP. It can be found at the end of the Bastion Server deployment log, in \"Outputs\", before \"Command finished successfully\" message."
}
variable "RESOURCE_GROUP" {
type = string
description = "The name of an EXISTING Resource Group, previously created by the user. The list of Resource Groups is available here: https://cloud.ibm.com/account/resource-groups"
default = "Default"
}
variable "REGION" {
type = string
description = "The cloud region where to deploy the solution. The regions and zones for VPC are available here: https://cloud.ibm.com/docs/containers?topic=containers-regions-and-zones#zones-vpc. Supported locations in IBM Cloud Schematics: https://cloud.ibm.com/docs/schematics?topic=schematics-locations."
validation {
condition = contains(["eu-de", "eu-gb", "us-south", "us-east", "ca-tor", "au-syd", "jp-osa", "jp-tok", "eu-es", "br-sao"], var.REGION)
error_message = "The REGION must be one of: eu-de, eu-gb, us-south, us-east, ca-tor, au-syd, jp-osa, jp-tok, eu-es, br-sao."
}
}
variable "ZONE" {
type = string
description = "Availability zone for VSIs, in the same VPC. Supported zones: https://cloud.ibm.com/docs/containers?topic=containers-regions-and-zones#zones-vpc"
validation {
condition = length(regexall("^(eu-de|eu-gb|us-south|us-east|ca-tor|au-syd|jp-osa|jp-tok|eu-es|br-sao)-(1|2|3)$", var.ZONE)) > 0
error_message = "The ZONE is not valid."
}
}
variable "VPC" {
type = string
description = "The name of an EXISTING VPC. Must be in the same region as the solution to be deployed. The list of VPCs is available here: https://cloud.ibm.com/vpc-ext/network/vpcs."
validation {
condition = length(regexall("^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$", var.VPC)) > 0
error_message = "The VPC name is not valid."
}
}
variable "SUBNET" {
type = string
description = "The name of an EXISTING Subnet, in the same VPC, region and zone as the VSIs to be created. The list of Subnets is available here: https://cloud.ibm.com/vpc-ext/network/subnets"
validation {
condition = length(regexall("^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$", var.SUBNET)) > 0
error_message = "The SUBNET name is not valid."
}
}
variable "SECURITY_GROUP" {
type = string
description = "The name of an EXISTING Security group for the same VPC. It can be found at the end of the Bastion Server deployment log, in \"Outputs\", before \"Command finished successfully\" message. The list of Security Groups is available here: https://cloud.ibm.com/vpc-ext/network/securityGroups."
validation {
condition = length(regexall("^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$", var.SECURITY_GROUP)) > 0
error_message = "The SECURITY_GROUP name is not valid."
}
}
variable "DB_HOSTNAME" {
type = string
description = "The Hostname for the DB VSI. The hostname should be up to 13 characters, as required by SAP"
validation {
condition = length(var.DB_HOSTNAME) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.DB_HOSTNAME)) > 0
error_message = "The DB_HOSTNAME is not valid."
}
}
variable "DB_PROFILE" {
type = string
description = "The profile for the DB VSI. The certified profiles for SAP HANA in IBM VPC: https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc"
default = "mx2-16x128"
validation {
condition = contains(keys(jsondecode(file("modules/db-vsi/files/hana_vm_volume_layout.json")).profiles), "${var.DB_PROFILE}")
error_message = "The chosen storage PROFILE for HANA VSI \"${var.DB_PROFILE}\" is not a certified storage profile. Please, chose the appropriate certified storage PROFILE for the HANA VSI from https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-intel-vs-vpc . Make sure the selected PROFILE is certified for the selected OS type and for the proceesing type (SAP Business One, OLTP, OLAP)"
}
}
variable "DB_IMAGE" {
type = string
description = "OS image for DB VSI. A list of images is available here: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images."
default = "ibm-redhat-9-4-amd64-sap-hana-3"
validation {
condition = length(regexall("^(ibm-redhat-9-4-amd64-sap-hana|ibm-redhat-8-6-amd64-sap-hana|ibm-redhat-8-4-amd64-sap-hana|ibm-sles-15-6-amd64-sap-hana|ibm-sles-15-5-amd64-sap-hana|ibm-sles-15-4-amd64-sap-hana|ibm-sles-15-3-amd64-sap-hana)-[0-9][0-9]*", var.DB_IMAGE)) > 0
error_message = "The OS SAP DB_IMAGE must be one of \"ibm-redhat-9-4-amd64-sap-hana-x\", \"ibm-redhat-8-6-amd64-sap-hana-x\", \"ibm-redhat-8-4-amd64-sap-hana-x\", \"ibm-sles-15-6-amd64-sap-hana-x\", \"ibm-sles-15-5-amd64-sap-hana-x\", \"ibm-sles-15-4-amd64-sap-hana-x\", or \"ibm-sles-15-3-amd64-sap-hana-x\"."
}
}
variable "APP_HOSTNAME" {
type = string
description = "The Hostname for the APP VSI. The hostname should be up to 13 characters, as required by SAP"
validation {
condition = length(var.APP_HOSTNAME) <= 13 && length(regexall("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$", var.APP_HOSTNAME)) > 0
error_message = "The APP_HOSTNAME is not valid."
}
}
variable "APP_PROFILE" {
type = string
description = "The profile for the APP VSI. A list of profiles is available here: https://cloud.ibm.com/docs/vpc?topic=vpc-profiles. For more information, check SAP Note 2927211: \"SAP Applications on IBM Virtual Private Cloud\"."
default = "bx2-4x16"
}
variable "APP_IMAGE" {
type = string
description = "OS image for APP VSI. A list of images is available here: https://cloud.ibm.com/docs/vpc?topic=vpc-about-images."
default = "ibm-redhat-9-4-amd64-sap-applications-3"
validation {
condition = length(regexall("^(ibm-redhat-9-4-amd64-sap-applications|ibm-redhat-8-6-amd64-sap-applications|ibm-redhat-8-4-amd64-sap-applications|ibm-sles-15-6-amd64-sap-applications|ibm-sles-15-5-amd64-sap-applications|ibm-sles-15-4-amd64-sap-applications|ibm-sles-15-3-amd64-sap-applications)-[0-9][0-9]*", var.APP_IMAGE)) > 0
error_message = "The OS SAP APP_IMAGE must be one of \"ibm-redhat-9-4-amd64-sap-applications-x\", \"ibm-redhat-8-6-amd64-sap-applications-x\", \"ibm-redhat-8-4-amd64-sap-applications-x\", \"ibm-sles-15-6-amd64-sap-applications-x\", \"ibm-sles-15-5-amd64-sap-applications-x\", \"ibm-sles-15-4-amd64-sap-applications-x\" or \"ibm-sles-15-3-amd64-sap-applications-x\"."
}
}
data "ibm_is_instance" "db-vsi" {
depends_on = [module.db-vsi]
name = var.DB_HOSTNAME
}
data "ibm_is_instance" "app-vsi" {
depends_on = [module.app-vsi]
name = var.APP_HOSTNAME
}
variable "HANA_SID" {
type = string
description = "The SAP HANA system ID. Identifies the entire SAP HANA system. Consists of three alphanumeric characters and the first character must be a letter. Does not include any of the reserved IDs listed in SAP Note 1979280."
default = "HDB"
validation {
condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.HANA_SID)) > 0
error_message = "The HANA_SID is not valid."
}
}
variable "HANA_SYSNO" {
type = string
description = "The instance number of the SAP HANA system. Should follow the SAP rules for instance number naming. Consists of two-digit number from 00 to 97. Must be unique on a host"
default = "00"
validation {
condition = var.HANA_SYSNO >= 0 && var.HANA_SYSNO <=97
error_message = "The HANA_SYSNO is not valid."
}
}
variable "HANA_TENANT" {
type = string
description = "The name of the SAP HANA tenant."
default = "JV1"
validation {
condition = length(regexall("^[A-Za-z0-9-_]+$", var.HANA_TENANT)) > 0 && !contains(["ADD", "ALL", "AMD", "AND", "ANY", "ARE", "ASC", "AUX", "AVG", "BIT", "CDC", "COM", "CON", "DBA", "END", "EPS", "FOR", "GET", "GID", "IBM", "INT", "KEY", "LOG", "LPT", "MAP", "MAX", "MIN", "MON", "NIX", "NOT", "NUL", "OFF", "OLD", "OMS", "OUT", "PAD", "PRN", "RAW", "REF", "ROW", "SAP", "SET", "SGA", "SHG", "SID", "SQL", "SUM", "SYS", "TMP", "TOP", "UID", "USE", "USR", "VAR"], var.HANA_TENANT)
error_message = "The name of SAP HANA tenant HANA_TENANT is not valid."
}
}
variable "HANA_SYSTEM_USAGE" {
type = string
description = "SAP HANA System usage. Suported values: production, test, development, custom"
default = "custom"
validation {
condition = contains(["production", "test", "development", "custom" ], var.HANA_SYSTEM_USAGE )
error_message = "The HANA_SYSTEM_USAGE must be one of: production, test, development, custom."
}
}
variable "HANA_COMPONENTS" {
type = string
description = "SAP HANA Components. Supported values: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp"
default = "server"
validation {
condition = contains(["all", "client", "es", "ets", "lcapps", "server", "smartda", "streaming", "rdsync", "xs", "studio", "afl", "sca", "sop", "eml", "rme", "rtl", "trp" ], var.HANA_COMPONENTS )
error_message = "The HANA_COMPONENTS must be one of: all, client, es, ets, lcapps, server, smartda, streaming, rdsync, xs, studio, afl, sca, sop, eml, rme, rtl, trp."
}
}
variable "KIT_SAPHANA_FILE" {
type = string
description = "SAP HANA Installation kit path (ZIP/SAR file), as downloaded from SAP Support Portal"
default = "/storage/HANADB/SP07/Rev77/IMDB_SERVER20_077_0-80002031.SAR"
}
variable "SAP_SID" {
type = string
description = "The SAP system ID. Identifies the entire SAP system. Consists of three alphanumeric characters and the first character must be a letter. Does not include any of the reserved IDs listed in SAP Note 1979280."
default = "JV1"
validation {
condition = length(regexall("^[a-zA-Z][a-zA-Z0-9][a-zA-Z0-9]$", var.SAP_SID)) > 0
error_message = "The SAP_SID is not valid."
}
}
variable "SAP_SCS_INSTANCE_NUMBER" {
type = string
description = "The central service instance number. Technical identifier for internal processes of SCS. Consists of a two-digit number from 00 to 97. Must be unique on a host. Must follow the SAP rules for instance number naming."
default = "01"
validation {
condition = var.SAP_SCS_INSTANCE_NUMBER >= 0 && var.SAP_SCS_INSTANCE_NUMBER <=97
error_message = "The SAP_SCS_INSTANCE_NUMBER is not valid."
}
}
variable "SAP_CI_INSTANCE_NUMBER" {
type = string
description = "The SAP central instance number. Technical identifier for internal processes of PAS. Consists of a two-digit number from 00 to 97. Must be unique on a host. Must follow the SAP rules for instance number naming"
default = "00"
validation {
condition = var.SAP_CI_INSTANCE_NUMBER >= 0 && var.SAP_CI_INSTANCE_NUMBER <=97
error_message = "The SAP_CI_INSTANCE_NUMBER is not valid."
}
}
variable "JAVA_NODES" {
type = string
description = "The number of JAVA server nodes."
default = "2"
validation {
condition = var.JAVA_NODES >= 1
error_message = "The number of JAVA server nodes is not valid."
}
}
variable "JAVA_PRODUCT_INSTANCES" {
type = list(string)
description = "The list of JAVA product instances. The list can contain the following elements: \"AdobeDocumentServices\", \"BIJAVA\", \"BPM\", \"CentralProcessScheduling\", \"CompositionPlatform\", \"DevelopmentInfrastructure\", \"EPCore-ApplicationPortal\", \"EnterprisePortal\", \"EnterpriseServicesRepository\", \"PDFExport\". Example: JAVA_PRODUCT_INSTANCES = [\"AdobeDocumentServices\", \"BIJAVA\"]"
default = []
}
variable "SAP_MAIN_PASSWORD" {
type = string
sensitive = true
description = "The SAP MAIN Password. Common password for all users that are created during the installation. It must be 15 to 30 characters long. It must contain at least: one digit (0-9), one lowercase letter (a-z), one uppercase letter (A-Z). It may contain one of the following special characters: !, #, _, @, $. It must start with a lowercase letter (a-z) or with an uppercase letter (A-Z)."
validation {
condition = length(var.SAP_MAIN_PASSWORD) >= 15 && length(var.SAP_MAIN_PASSWORD) <= 30 && length(regexall("[0-9]", var.SAP_MAIN_PASSWORD)) > 0 && length(regexall("[a-z]", var.SAP_MAIN_PASSWORD)) > 0 && length(regexall("[A-Z]", var.SAP_MAIN_PASSWORD)) > 0 && can(regex("^[a-zA-Z0-9!#_@$]*$", var.SAP_MAIN_PASSWORD)) && length(regexall("^([a-z]|[A-Z])", var.SAP_MAIN_PASSWORD)) > 0
error_message = "The SAP_MAIN_PASSWORD is not valid. It must be 15 to 30 characters long. It must contain at least: one digit (0-9), one lowercase letter (a-z), one uppercase letter (A-Z). It may contain one of the following special characters: !, #, _, @, $. It must start with a lowercase letter (a-z) or with an uppercase letter (A-Z)."
}
}
variable "KIT_SAPCAR_FILE" {
type = string
description = "Path to sapcar binary, as downloaded from SAP Support Portal."
default = "/storage/NW75HDB/SAPCAR_1300-70007716.EXE"
}
variable "KIT_SWPM_FILE" {
type = string
description = "Path to SWPM archive (SAR), as downloaded from SAP Support Portal"
default = "/storage/NW75HDB/SWPM10SP42_0-20009701.SAR"
}
variable "KIT_SAPEXE_FILE" {
type = string
description = "Path to SAP Kernel OS archive (SAR), as downloaded from SAP Support Portal."
default = "/storage/NW75HDB/KERNEL/7.54UC/SAPEXE_400-80007612.SAR"
}
variable "KIT_SAPEXEDB_FILE" {
type = string
description = "Path to SAP Kernel DB archive (SAR), as downloaded from SAP Support Portal."
default = "/storage/NW75HDB/KERNEL/7.54UC/SAPEXEDB_400-80007611.SAR"
}
variable "KIT_IGSEXE_FILE" {
type = string
description = "Path to IGS archive (SAR), as downloaded from SAP Support Portal."
default = "/storage/NW75HDB/KERNEL/7.54UC/igsexe_5-80007786.sar"
}
variable "KIT_IGSHELPER_FILE" {
type = string
description = "Path to IGS Helper archive (SAR), as downloaded from SAP Support Portal."
default = "/storage/NW75HDB/KERNEL/igshelper_17-10010245.sar"
}
variable "KIT_SAPHOSTAGENT_FILE" {
type = string
description = "Path to SAP Host Agent archive (SAR), as downloaded from SAP Support Portal."
default = "/storage/NW75HDB/SAPHOSTAGENT65_65-80004822.SAR"
}
variable "KIT_HDBCLIENT_FILE" {
type = string
description = "Path to SAP HANA client file (SAR), as downloaded from SAP Support Portal"
default = "/storage/NW75HDB/IMDB_CLIENT20_022_32-80002082.SAR"
}
variable "KIT_SAPJVM_FILE" {
type = string
description = "Path to SAP JVM archive (SAR), as downloaded from SAP Support Portal"
default = "/storage/NW75HDB/SAPJVM81/SAPJVM8_102-80000202.SAR"
}
variable "KIT_JAVA_EXPORT_FILE" {
type = string
description = "Path to JAVA Installation Export ZIP file. The archives downloaded from SAP Support Portal should be present in this path"
default = "/storage/NW75HDB/JAVAEXP/SP22/51055106.ZIP"
}
locals {
java_product_instances_lower = tolist([for inst in var.JAVA_PRODUCT_INSTANCES : "${trimspace(lower(inst))}"])
}
resource "null_resource" "check_java_instances" {
lifecycle {
precondition {
condition = length(setintersection(["adobedocumentservices", "bijava", "bpm", "centralprocessscheduling", "compositionplatform", "developmentinfrastructure", "epcore-applicationportal", "enterpriseportal", "enterpriseservicesrepository", "pdfexport"], local.java_product_instances_lower)) == length(local.java_product_instances_lower)
error_message = "The list can contain the following elements: AdobeDocumentServices, BIJAVA, BPM, CentralProcessScheduling, CompositionPlatform, DevelopmentInfrastructure, EPCore-ApplicationPortal, EnterprisePortal, EnterpriseServicesRepository, PDFExport."
}
}
}