diff --git a/terraform/locals.tf b/terraform/locals.tf index 7f3cf9d..767099c 100644 --- a/terraform/locals.tf +++ b/terraform/locals.tf @@ -1,5 +1,6 @@ locals { - resource_suffix = [lower(var.environment), substr(lower(var.location), 0, 2), substr(lower(var.application), 0, 3), lower(var.owner), random_id.resource_group_name_suffix.hex, var.resource_group_name_suffix] + generated_suffix = coalesce(var.cohort_suffix, random_id.resource_group_name_suffix.hex) + resource_suffix = [lower(var.environment), substr(lower(var.location), 0, 2), substr(lower(var.application), 0, 3), lower(var.owner), local.generated_suffix, var.resource_group_name_suffix] resource_suffix_kebabcase = join("-", local.resource_suffix) resource_suffix_lowercase = join("", local.resource_suffix) @@ -15,6 +16,7 @@ locals { "Scm" = var.scm, "Application" = var.application "Resource Suffix" = var.resource_group_name_suffix + "Cohort Suffix" = local.generated_suffix } ) ) diff --git a/terraform/providers.tf b/terraform/providers.tf index 36f8f14..9dc629e 100644 --- a/terraform/providers.tf +++ b/terraform/providers.tf @@ -16,8 +16,8 @@ terraform { } } - backend "local" {} - # backend "azurerm" {} + # backend "local" {} + backend "azurerm" {} } provider "azurerm" { diff --git a/terraform/variables.tf b/terraform/variables.tf index 3b42e8c..4de2670 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -72,4 +72,10 @@ variable "user_id" { description = "The user id to assign the Contributor role to the resource group" type = string default = "" -} \ No newline at end of file +} + +variable "cohort_suffix" { + description = "[Optional] A cohort suffix for a specific lab to be edited. Helps with keeping track of labs' cohorts in the same subscription" + type = string + default = "" +}