diff --git a/modules/storage_accounts/variables.tf b/modules/storage_accounts/variables.tf index 8ba3ab9..9d7e3fe 100644 --- a/modules/storage_accounts/variables.tf +++ b/modules/storage_accounts/variables.tf @@ -4,6 +4,17 @@ variable "admin" { name = string email = string }) + + validation { + condition = try( + regex("hpccdemo", var.admin.name) != "hpccdemo", true + ) && try( + regex("hpccdemo", var.admin.email) != "hpccdemo", true + ) && try( + regex("@example.com", var.admin.email) != "@example.com", true + ) + error_message = "Your name and email are required in the admin block and must not contain hpccdemo or @example.com." + } } variable "disable_naming_conventions" { diff --git a/modules/virtual_network/variables.tf b/modules/virtual_network/variables.tf index a22a02f..34db883 100644 --- a/modules/virtual_network/variables.tf +++ b/modules/virtual_network/variables.tf @@ -4,6 +4,17 @@ variable "admin" { name = string email = string }) + + validation { + condition = try( + regex("hpccdemo", var.admin.name) != "hpccdemo", true + ) && try( + regex("hpccdemo", var.admin.email) != "hpccdemo", true + ) && try( + regex("@example.com", var.admin.email) != "@example.com", true + ) + error_message = "Your name and email are required in the admin block and must not contain hpccdemo or @example.com." + } } variable "disable_naming_conventions" { diff --git a/variables.tf b/variables.tf index a49809c..fa3424c 100644 --- a/variables.tf +++ b/variables.tf @@ -4,6 +4,17 @@ variable "admin" { name = string email = string }) + + validation { + condition = try( + regex("hpccdemo", var.admin.name) != "hpccdemo", true + ) && try( + regex("hpccdemo", var.admin.email) != "hpccdemo", true + ) && try( + regex("@example.com", var.admin.email) != "@example.com", true + ) + error_message = "Your name and email are required in the admin block and must not contain hpccdemo or @example.com." + } } variable "expose_services" {