The argument "storage_connection_string" is required, but no definition was found

Viewed 410

I'm currently trying to set up an Azure Function app using Terraform.

Using the documentation from Hasihcorp found here.

However when running a terraform plan I'm getting the following error: The argument "storage_connection_string" is required, but no definition was found.

According to the documentation there is no such valid parameter and as such I've not included it. I've only found one entry on this while looking about and it was only a question, with no response. I'm not well versed in Azure so don't know if I need the storage_connection_string or if it's the API that is messing with me.

The resource snippet:

resource "azurerm_function_app" "this" {
  name = "function-name"
  resource_group_name = "resource-group"
  location = "location"
  app_service_plan_id = "id"
  storage_account_name = "name"
  storage_account_access_key = "key"

Formatting and referencing of values are set up but I don't have the code on this computer so made more sense to just post it like this.

1 Answers

This most likely arises from using an outdated version of the azure provider. E.g. version 2.0.0 has a required storage_connection_string. That got removed in some version.

Solution: upgrade your used provider version. Somewhere you should have declared that you want to use the azure provider. At that place you should specify a version constraint as well, e.g.:

terraform {
  required_providers {
    azure = {
      version = "~> 2.40.0"
    }
  }
}

Or alternatively you should only look at the documentation matching your current provider + terraform version.

Related