6

When I attempt to run the code at the bottom I get the following error (no matter what I name the storage account) currently its named "functions" but I could call it "bannanas" and it would output the same error?

ERROR I ENCOUNTER :(

"1 error(s) occurred:

  • azurerm_storage_account.test: 1 error(s) occurred:

  • azurerm_storage_account.test: Error creating Azure Storage Account "functions": storage.AccountsClient#Create: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status= Code="StorageAccountAlreadyTaken" Message="The storage account named functions is already taken."

My code:

resource "azurerm_resource_group" "test" {
  name     = "azure-functions-cptest-rg"
  location = "westus2"
}

resource "azurerm_storage_account" "test" {
  name                     = "functionsapptestsa"
  resource_group_name      = "${azurerm_resource_group.test.name}"
  location                 = "${azurerm_resource_group.test.location}"
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_app_service_plan" "test" {
  name                = "azure-functions-test-service-plan"
  location            = "${azurerm_resource_group.test.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  kind                = "FunctionApp"

  sku {
    tier = "Dynamic"
    size = "Y1"
  }
}

resource "azurerm_function_app" "test" {
  name                      = "test-azure-functions"
  location                  = "${azurerm_resource_group.test.location}"
  resource_group_name       = "${azurerm_resource_group.test.name}"
  app_service_plan_id       = "${azurerm_app_service_plan.test.id}"
  storage_connection_string = "${azurerm_storage_account.test.primary_connection_string}"
}
4c74356b41
  • 628
  • 5
  • 10
wildstallion
  • 61
  • 1
  • 2

1 Answers1

9

This happends because storage account name is UNIQUE in all Azure, try something more unique :)

Like: functions12df3f4g or rebgh35h3brw4t3ghr

4c74356b41
  • 628
  • 5
  • 10