From 0c7d0d0eaa5c9c67e7f922151bf52d95d6141e19 Mon Sep 17 00:00:00 2001 From: Sebastian Haderecker Date: Thu, 15 Apr 2021 15:16:33 +0200 Subject: [PATCH] TF: Check if input variables are defined --- cloud/terraform/otc/variables.tf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cloud/terraform/otc/variables.tf b/cloud/terraform/otc/variables.tf index 0c62edbf..40831815 100644 --- a/cloud/terraform/otc/variables.tf +++ b/cloud/terraform/otc/variables.tf @@ -6,6 +6,11 @@ variable "timezone" { variable "linux_password" { #default = "LiNuXuSeRPaSs#" description = "Set a password for the default user" + + validation { + condition = length(var.linux_password) > 0 + error_message = "Please specify a password for the default user." + } } # Cloud resources name configuration @@ -47,6 +52,11 @@ variable "flavor" { variable "key_pair" { #default = "" description = "Specify your SSH key pair" + + validation { + condition = length(var.key_pair) > 0 + error_message = "Please specify a Key Pair." + } } variable "volume_size" { @@ -68,4 +78,9 @@ variable "web_user" { variable "web_password" { #default = "w3b$ecret" description = "Set a password for the web user" + + validation { + condition = length(var.web_password) > 0 + error_message = "Please specify a password for the web user." + } }