From 8fe51e092141fcec9adc50046281c818da2cb6f6 Mon Sep 17 00:00:00 2001 From: Godji Fortil Date: Fri, 14 Apr 2023 11:44:32 -0400 Subject: [PATCH] Stop users from using hpccdemo as a tag Signed-off-by: Godji Fortil --- modules/storage_accounts/variables.tf | 11 +++++++++++ modules/virtual_network/variables.tf | 11 +++++++++++ variables.tf | 11 +++++++++++ 3 files changed, 33 insertions(+) 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" {