Skip to content

Commit c91a000

Browse files
committed
update fully configurable elasticsearch variables
1 parent 6c6dad3 commit c91a000

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

solutions/fully-configurable/variables.tf

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ variable "ibmcloud_api_key" {
88
sensitive = true
99
}
1010

11+
variable "existing_resource_group_name" {
12+
type = string
13+
description = "The name of an existing resource group to provision the Databases for Elasticsearch in."
14+
default = "Default"
15+
nullable = false
16+
}
17+
1118
variable "provider_visibility" {
1219
description = "Set the visibility value for the IBM terraform provider. Supported values are `public`, `private`, `public-and-private`. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints)."
1320
type = string
1421
default = "private"
15-
22+
nullable = false
1623
validation {
1724
condition = contains(["public", "private", "public-and-private"], var.provider_visibility)
1825
error_message = "Invalid visibility option. Allowed values are 'public', 'private', or 'public-and-private'."
@@ -21,23 +28,28 @@ variable "provider_visibility" {
2128

2229
variable "prefix" {
2330
type = string
24-
description = "Prefix to add to all resources created by this solution. To not use any prefix value, you can set this value to `null` or an empty string."
31+
description = "The prefix to add to all resources that this solution creates (e.g `prod`, `test`, `dev`). To not use any prefix value, you can set this value to `null` or an empty string."
32+
nullable = true
33+
validation {
34+
condition = (var.prefix == null ? true :
35+
alltrue([
36+
can(regex("^[a-z]{0,1}[-a-z0-9]{0,14}[a-z0-9]{0,1}$", var.prefix)),
37+
length(regexall("^.*--.*", var.prefix)) == 0
38+
])
39+
)
40+
error_message = "Prefix must begin with a lowercase letter, contain only lowercase letters, numbers, and - characters. Prefixes must end with a lowercase letter or number and be 16 or fewer characters."
41+
}
2542
}
2643

2744
##############################################################################
2845
# Input Variables
2946
##############################################################################
3047

31-
variable "existing_resource_group_name" {
32-
type = string
33-
description = "The name of an existing resource group to provision the Databases for Elasicsearch in."
34-
default = "Default"
35-
}
36-
3748
variable "name" {
3849
type = string
3950
description = "The name of the Databases for Elasticsearch instance. If a prefix input variable is specified, the prefix is added to the name in the `<prefix>-<name>` format."
4051
default = "elasticsearch"
52+
nullable = false
4153
}
4254

4355
variable "elasticsearch_version" {
@@ -56,18 +68,21 @@ variable "region" {
5668
type = string
5769
description = "The region where you want to deploy your instance, or the region in which your existing instance is in."
5870
default = "us-south"
71+
nullable = false
5972
}
6073

6174
variable "plan" {
6275
type = string
6376
description = "The name of the service plan for your Databases for Elasticsearch instance. Possible values: `enterprise`, `platinum`."
6477
default = "platinum"
78+
nullable = false
6579
}
6680

6781
variable "service_endpoints" {
6882
type = string
6983
description = "Specify whether you want to enable public, or both public and private service endpoints. Possible values: `public`, `public-and-private`"
7084
default = "private"
85+
nullable = false
7186
validation {
7287
condition = contains(["public", "private"], var.service_endpoints)
7388
error_message = "The specified service endpoint is not supported. The following endpoint options are supported: `public`, `private`"
@@ -78,18 +93,21 @@ variable "existing_elasticsearch_instance_crn" {
7893
type = string
7994
default = null
8095
description = "The CRN of an existing Databases for Elasticsearch instance. If no value is specified, a new instance is created."
96+
nullable = true
8197
}
8298

8399
variable "enable_elser_model" {
84100
type = bool
85101
description = "Set it to true to install and start the Elastic's Natural Language Processing model. [Learn more](https://cloud.ibm.com/docs/databases-for-elasticsearch?topic=databases-for-elasticsearch-elser-embeddings-elasticsearch)"
86102
default = false
103+
nullable = false
87104
}
88105

89106
variable "elser_model_type" {
90107
type = string
91108
description = "Trained ELSER model to be used for Elastic's Natural Language Processing. Possible values: `.elser_model_1`, `.elser_model_2` and `.elser_model_2_linux-x86_64`. Applies only if also 'plan' is set to 'platinum' and 'enable_elser_model' is enabled. [Learn more](https://www.elastic.co/guide/en/machine-learning/current/ml-nlp-elser.html)"
92109
default = ".elser_model_2_linux-x86_64"
110+
nullable = false
93111
validation {
94112
condition = contains([".elser_model_1", ".elser_model_2", ".elser_model_2_linux-x86_64"], var.elser_model_type)
95113
error_message = "The specified elser_model_type is not a valid selection!"

0 commit comments

Comments
 (0)