@@ -120,6 +120,24 @@ validating_variables() {
120120 echo " ========================================================================================="
121121 exit 1
122122 fi
123+
124+ # workshop_name variable to validate
125+ validate_workshop_name () {
126+ if [[ ! " $workshop_name " =~ ^[a-z0-9-]+$ || ${# workshop_name} -gt 12 ]]; then
127+ echo " Error: workshop_name must be 12 characters or less and consist only of lowercase letters, numbers, and hyphens (-)."
128+ exit 1
129+ fi
130+ }
131+ validate_datalake_version () {
132+ if [[ -z " $datalake_version " || " $datalake_version " == " latest" || " $datalake_version " =~ ^[0-9]+\. [0-9]+\. [0-9]+$ ]]; then
133+ return 0 # Valid value
134+ else
135+ echo " Error: Valid values for datalake_version are 'latest' or a semantic version (e.g., 7.2.17)."
136+ return 1 # Invalid value
137+ fi
138+ }
139+ validate_workshop_name
140+ validate_datalake_version
123141 }
124142
125143 # --------------------------------------------------------------------------------------------------#
@@ -257,14 +275,16 @@ validating_variables() {
257275 CDP_GROUP_LIMIT)
258276 cdp_group_limit=$value
259277 ;;
278+ DATALAKE_VERSION)
279+ datalake_version=$value
280+ ;;
260281 # Can Add more cases if required.
261282 esac
262283 fi
263284 done < " $USER_CONFIG_FILE "
264285
265286 # Call the function with the user-provided config file as an argument
266287 check_config " $USER_CONFIG_FILE "
267-
268288 echo
269289 echo " ------------------------------------------------------------------- "
270290 echo " Validated the Configfile and Verified the Provided Input Parameters "
654674 -var " aws_region=${aws_region} " \
655675 -var " aws_key_pair=${aws_key_pair} " \
656676 -var " deployment_template=${deployment_template} " \
657- -var " ingress_extra_cidrs_and_ports={cidrs = [" ${cdp_cidr} " ],ports = [443, 22]}"
677+ -var " ingress_extra_cidrs_and_ports={cidrs = [" ${cdp_cidr} " ],ports = [443, 22]}" \
678+ -var " datalake_version=${datalake_version} "
658679 cdp_provision_status=$?
659680 if [ $cdp_provision_status -eq 0 ]; then
660681 export ENV_PUBLIC_SUBNETS=$( terraform output -json aws_public_subnet_ids)
0 commit comments