From ca06940643f41ac92fa181e6723e694b5dbae89a Mon Sep 17 00:00:00 2001 From: Tom Archer Date: Thu, 31 Oct 2024 19:25:06 -0700 Subject: [PATCH] Changes to storage --- quickstart/101-azure-functions/main.tf | 28 +++++++++++++-------- quickstart/101-azure-functions/variables.tf | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/quickstart/101-azure-functions/main.tf b/quickstart/101-azure-functions/main.tf index dcc6cddf..9e50a36d 100644 --- a/quickstart/101-azure-functions/main.tf +++ b/quickstart/101-azure-functions/main.tf @@ -13,22 +13,28 @@ resource "random_string" "unique_id" { } locals { - functionAppName = var.appName - hostingPlanName = var.appName - applicationInsightsName = var.appName + functionAppName = "fnapp${random_string.unique_id.result}" + hostingPlanName = "fnapp${random_string.unique_id.result}" + applicationInsightsName = "fnapp${random_string.unique_id.result}" storageAccountName = "${random_string.unique_id.result}azfunctions" functionWorkerRuntime = var.runtime } -resource "azurerm_storage_account" "storageAccount" { - name = local.storageAccountName - location = azurerm_resource_group.rg.location - resource_group_name = azurerm_resource_group.rg.name - account_tier = "Standard" - account_replication_type = var.storageAccountType +# Generate random value for the storage account name +resource "random_string" "storage_account_name" { + length = 8 + lower = true + numeric = false + special = false + upper = false +} - enable_https_traffic_only = true - allow_blob_public_access = false +resource "azurerm_storage_account" "storageAccount" { + name = random_string.storage_account_name.result + resource_group_name = azurerm_resource_group.rg.name + location = azurerm_resource_group.rg.location + account_tier = "Standard" + account_replication_type = "LRS" } resource "azurerm_app_service_plan" "hostingPlan" { diff --git a/quickstart/101-azure-functions/variables.tf b/quickstart/101-azure-functions/variables.tf index bbaf671b..f1914d8f 100644 --- a/quickstart/101-azure-functions/variables.tf +++ b/quickstart/101-azure-functions/variables.tf @@ -12,7 +12,7 @@ variable "resource_group_location" { variable "appName" { type = string - default = "fnapp${random_string.unique_id.result}" + default = "fnapp" description = "The name of the function app that you wish to create." }