add random suffix to resource group name

This commit is contained in:
zjhe 2024-10-05 10:43:31 +08:00
parent dcca3ba6ef
commit ff0b2795ab
6 changed files with 12 additions and 6 deletions

View File

@ -4,8 +4,14 @@ locals {
hub-nva-resource-group = "hub-nva-rg"
}
resource "random_string" "suffix" {
length = 5
special = false
upper = false
}
resource "azurerm_resource_group" "hub-nva-rg" {
name = "${local.prefix-hub-nva}-rg"
name = "${local.prefix-hub-nva}-rg-${random_string.suffix.result}"
location = local.hub-nva-location
tags = {

View File

@ -1,7 +1,7 @@
locals {
prefix-hub = "hub"
hub-location = "eastus"
hub-resource-group = "hub-vnet-rg"
hub-resource-group = "hub-vnet-rg-${random_string.suffix.result}"
shared-key = "4-v3ry-53cr37-1p53c-5h4r3d-k3y"
}

View File

@ -19,7 +19,7 @@ provider "azurerm" {
}
resource "random_password" "password" {
count = var.password == null ? 1 : 0
count = var.password == null ? 1 : 0
length = 20
}

View File

@ -1,6 +1,6 @@
locals {
onprem-location = "eastus"
onprem-resource-group = "onprem-vnet-rg"
onprem-resource-group = "onprem-vnet-rg-${random_string.suffix.result}"
prefix-onprem = "onprem"
}

View File

@ -1,6 +1,6 @@
locals {
spoke1-location = "eastus"
spoke1-resource-group = "spoke1-vnet-rg"
spoke1-resource-group = "spoke1-vnet-rg-${random_string.suffix.result}"
prefix-spoke1 = "spoke1"
}

View File

@ -1,6 +1,6 @@
locals {
spoke2-location = "eastus"
spoke2-resource-group = "spoke2-vnet-rg"
spoke2-resource-group = "spoke2-vnet-rg-${random_string.suffix.result}"
prefix-spoke2 = "spoke2"
}