add random suffix to avoid naming conflict

This commit is contained in:
zjhe 2024-10-05 15:02:59 +08:00 committed by lonegunmanb
parent 818621e32a
commit 532e836b9f

View File

@ -1,6 +1,6 @@
# Dependent resources for Azure Machine Learning
resource "azurerm_application_insights" "default" {
name = "appi-${var.name}-${var.environment}"
name = "appi-${var.name}-${var.environment}-${random_string.suffix.result}"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
workspace_id = azurerm_log_analytics_workspace.default.id
@ -22,7 +22,7 @@ resource "azurerm_key_vault" "default" {
}
resource "azurerm_storage_account" "default" {
name = "st${var.name}${var.environment}"
name = "st${var.name}${var.environment}${random_string.suffix.result}"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
account_tier = "Standard"
@ -36,7 +36,7 @@ resource "azurerm_storage_account" "default" {
}
resource "azurerm_container_registry" "default" {
name = "cr${var.name}${var.environment}"
name = "cr${var.name}${var.environment}${random_string.suffix.result}"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
sku = "Premium"
@ -50,7 +50,7 @@ resource "azurerm_container_registry" "default" {
# Machine Learning workspace
resource "azurerm_machine_learning_workspace" "default" {
name = "mlw-${var.name}-${var.environment}"
name = "mlw-${var.name}-${var.environment}-${random_string.suffix.result}"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
application_insights_id = azurerm_application_insights.default.id