resource "random_pet" "rg_name" { prefix = var.resource_group_name_prefix } resource "azurerm_resource_group" "rg" { name = random_pet.rg_name.id location = var.resource_group_location } resource "random_string" "azurerm_storage_account_name" { length = 13 lower = true numeric = false special = false upper = false } resource "random_string" "azurerm_batch_account_name" { length = 13 lower = true numeric = false special = false upper = false } resource "azurerm_storage_account" "storage" { name = "storage${random_string.azurerm_storage_account_name.result}" resource_group_name = azurerm_resource_group.rg.name location = azurerm_resource_group.rg.location account_tier = element(split("_", var.storage_account_type), 0) account_replication_type = element(split("_", var.storage_account_type), 1) } resource "azurerm_batch_account" "batch" { name = "batch${random_string.azurerm_batch_account_name.result}" resource_group_name = azurerm_resource_group.rg.name location = azurerm_resource_group.rg.location storage_account_id = azurerm_storage_account.storage.id storage_account_authentication_mode = "StorageKeys" }