generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvariables.tf
223 lines (189 loc) · 10.7 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
variable "pi_workspace_guid" {
description = "Existing GUID of the PowerVS workspace. The GUID of the service instance associated with an account."
type = string
}
variable "pi_ssh_public_key_name" {
description = "Existing PowerVS SSH Public key name. Run 'ibmcloud pi keys' to list available keys."
type = string
}
variable "pi_instance_name" {
description = "Name of instance which will be created."
type = string
validation {
condition = length(var.pi_instance_name) <= 16
error_message = "Maximum length of Instance name must be less or equal to 16 characters only."
}
}
variable "pi_image_id" {
description = "Image ID used for PowerVS instance. Run 'ibmcloud pi images' to list available images."
type = string
}
variable "pi_boot_image_storage_pool" {
description = "Storage Pool for server deployment; Only valid when you deploy one of the IBM supplied stock images. Storage pool for a custom image (an imported image or an image that is created from a VM capture) defaults to the storage pool the image was created in."
type = string
default = null
}
variable "pi_boot_image_storage_tier" {
description = "Storage type for server deployment. If storage type is not provided the storage type will default to tier3. Possible values tier0, tier1 and tier3"
type = string
default = null
}
variable "pi_networks" {
description = "Existing list of private subnet ids to be attached to an instance. The first element will become the primary interface. Run 'ibmcloud pi networks' to list available private subnets."
type = list(
object({
name = string
id = string
cidr = optional(string)
})
)
}
variable "pi_sap_profile_id" {
description = "SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). If this is mentioned then pi_server_type, pi_cpu_proc_type, pi_number_of_processors and pi_memory_size will not be taken into account."
type = string
default = null
}
variable "pi_server_type" {
description = "The type of system on which to create the VM. Supported values are e980/s922/e1080/s1022. Required when not creating SAP instances. Conflicts with 'pi_sap_profile_id'."
type = string
default = null
validation {
condition = var.pi_server_type == null ? true : contains(["e980", "s922", "e1080", "s1022"], var.pi_server_type) ? true : false
error_message = "The system must be one of 'e980', 's922', 'e1080', or 's1022'."
}
}
variable "pi_cpu_proc_type" {
description = "The type of processor mode in which the VM will run with shared, capped or dedicated. Required when not creating SAP instances. Conflicts with 'pi_sap_profile_id'."
type = string
default = null
validation {
condition = var.pi_cpu_proc_type == null ? true : contains(["shared", "capped", "dedicated"], var.pi_cpu_proc_type) ? true : false
error_message = "The proc type must be one of 'shared', 'capped' or 'dedicated'."
}
}
variable "pi_number_of_processors" {
description = "The number of vCPUs to assign to the VM as visible within the guest Operating System. Required when not creating SAP instances. Conflicts with 'pi_sap_profile_id'."
type = string
default = null
}
variable "pi_memory_size" {
description = "The amount of memory that you want to assign to your instance in GB. Required when not creating SAP instances. Conflicts with 'pi_sap_profile_id'."
type = string
default = null
}
variable "pi_replicants" {
description = "The number of instances that you want to provision with the same configuration. If this parameter is not set, 1 is used by default. The replication policy that you want to use, either affinity, anti-affinity or none. If this parameter is not set, none is used by default. pi_placement_group_id cannot be used when specifying pi_replicants"
type = object({
count = number
policy = string
})
default = null
}
variable "pi_placement_group_id" {
description = "The ID of the placement group that the instance is in or empty quotes '' to indicate it is not in a placement group. pi_replicants cannot be used when specifying a placement group ID."
type = string
default = null
}
variable "pi_storage_config" {
description = "File systems to be created and attached to PowerVS instance. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace, 'mount' specifies the mount point on the OS."
type = list(object({
name = string
size = string
count = string
tier = string
mount = string
pool = optional(string)
}))
default = null
validation {
condition = var.pi_storage_config != null ? (
alltrue([for config in var.pi_storage_config : (
(config.name != "" && config.count != "" && config.tier != "" && config.mount != "") || (config.name == "" && config.count == "" && config.tier == "" && config.mount == "")
)])
) : var.pi_storage_config == null ? true : false
error_message = "One of the storage config has invalid value, probably an empty string'"
}
}
variable "pi_existing_volume_ids" {
description = "List of existing volume ids that must be attached to the instance."
type = list(string)
default = null
}
variable "pi_user_tags" {
description = "List of Tag names for IBM Cloud PowerVS instance and volumes. Can be set to null."
type = list(string)
default = null
}
#####################################################
# PowerVS Instance Initialization
#####################################################
variable "pi_instance_init_linux" {
description = "Configures a PowerVS linux instance to have internet access by setting proxy on it, updates os and create filesystems using ansible collection [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) where 'bastion_host_ip' is public IP of bastion/jump host to access the 'ansible_host_or_ip' private IP of ansible node. Additionally, specify whether IBM provided or customer provided linux subscription should be used. For IBM provided subscription leave custom_os_registration empty. For customer provided subscription set a username and a password inside custom_os_registration. Customer provided linux subscription requires the use of either an IBM provided image ending in BYOL or a custom image. The ansible host must have access to the power virtual server instance and ansible host OS must be RHEL distribution."
sensitive = true
type = object(
{
enable = bool
bastion_host_ip = string
ansible_host_or_ip = string
ssh_private_key = string
custom_os_registration = optional(object({
username = string
password = string
}))
}
)
default = {
enable = false
bastion_host_ip = ""
ansible_host_or_ip = ""
ssh_private_key = <<-EOF
EOF
}
validation {
condition = var.pi_instance_init_linux != null ? var.pi_instance_init_linux.enable ? var.pi_instance_init_linux.bastion_host_ip != "" && var.pi_instance_init_linux.bastion_host_ip != null && var.pi_instance_init_linux.ansible_host_or_ip != "" && var.pi_instance_init_linux.ansible_host_or_ip != null && var.pi_instance_init_linux.ssh_private_key != "" && var.pi_instance_init_linux.ssh_private_key != null ? true : false : true : true
error_message = "If 'enable' is true, then all attributes of 'pi_instance_init_linux' must be provided."
}
}
variable "ansible_vault_password" {
description = "Vault password to encrypt OS registration parameters. Only required with customer provided linux subscription (specified in pi_instance_init_linux.custom_os_registration). Password requirements: 15-100 characters and at least one uppercase letter, one lowercase letter, one number, and one special character. Allowed characters: A-Z, a-z, 0-9, !#$%&()*+-.:;<=>?@[]_{|}~."
type = string
sensitive = true
default = null
validation {
condition = var.pi_instance_init_linux.custom_os_registration == null ? true : var.ansible_vault_password != null
error_message = "Specifying custom_os_registration requires an ansible_vault_password so your credentials are stored securely."
}
}
variable "pi_network_services_config" {
description = "Configures network services proxy, NTP, NFS and DNS on PowerVS instance. Requires 'pi_instance_init_linux' to be specified to configure these services. The 'opts' attribute can take in comma separated values."
type = object(
{
squid = object({ enable = bool, squid_server_ip_port = string, no_proxy_hosts = string })
nfs = object({ enable = bool, nfs_server_path = string, nfs_client_path = string, opts = string, fstype = string })
dns = object({ enable = bool, dns_server_ip = string })
ntp = object({ enable = bool, ntp_server_ip = string })
}
)
default = {
squid = { enable = false, squid_server_ip_port = "", no_proxy_hosts = "" }
nfs = { enable = false, nfs_server_path = "", nfs_client_path = "", opts = "", fstype = "" }
dns = { enable = false, dns_server_ip = "" }
ntp = { enable = false, ntp_server_ip = "" }
}
validation {
condition = var.pi_network_services_config == null ? true : !var.pi_network_services_config.squid.enable || can(regex("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}:\\d+$", var.pi_network_services_config.squid.squid_server_ip_port))
error_message = "squid_server_ip_port must be in the format: x.x.x.x:y, where x=ip and y=port"
}
validation {
condition = var.pi_network_services_config == null ? true : !var.pi_network_services_config.nfs.enable || (var.pi_network_services_config.nfs.nfs_server_path != "" && var.pi_network_services_config.nfs.nfs_client_path != "" && var.pi_network_services_config.nfs.opts != "" && var.pi_network_services_config.nfs.fstype != "")
error_message = "Enabling NFS requires that nfs_server_path, nfs_client_path, opts, and fstype are specified."
}
validation {
condition = var.pi_network_services_config == null ? true : !var.pi_network_services_config.dns.enable || can(regex("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$", var.pi_network_services_config.dns.dns_server_ip))
error_message = "Enabling DNS requires dns_server_ip to be a valid IPv4 address."
}
validation {
condition = var.pi_network_services_config == null ? true : !var.pi_network_services_config.ntp.enable || can(regex("^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$", var.pi_network_services_config.ntp.ntp_server_ip))
error_message = "Enabling NTP requires ntp_server_ip to be a valid IPv4 address."
}
}