I was trying to get a Function deployed to Azure and I found the following sample code in the documentation and I had modified it to match up with the names I was planning on using for my test deployment and it failed to run as it was presented in the documentation. As I received a message about an unsupported argument around the storage_account_name not being expected in the resource block.
I recently took the entire sample and tried to run it as is for a test and there the following errors popped up in the planning phase of the testing.
These were the errors:
Error: Missing required argument
on functionsample.tf line 30, in resource "azurerm_function_app" "example":
30: resource "azurerm_function_app" "example" {
The argument "storage_connection_string" is required, but no definition was
found.
Error: Unsupported argument
on functionsample.tf line 35, in resource "azurerm_function_app" "example":
35: storage_account_name = azurerm_storage_account.example.name
An argument named "storage_account_name" is not expected here.
Error: Unsupported argument
on functionsample.tf line 36, in resource "azurerm_function_app" "example":
36: storage_account_access_key = azurerm_storage_account.example.primary_access_key
An argument named "storage_account_access_key" is not expected here.
This was the sample I was trying to get working in creating a function app in a consumption plan
resource "azurerm_resource_group" "example" {
name = “azure-functions-cptest-rg”
location = “westus2”
}
resource “azurerm_storage_account” “example” {
name = “functionsapptestsa”
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = “Standard”
account_replication_type = “LRS”
}
resource “azurerm_app_service_plan” “example” {
name = “azure-functions-test-service-plan”
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
kind = “FunctionApp”
sku {
tier = “Dynamic”
size = “Y1”
}
}
resource “azurerm_function_app” “example” {
name = “test-azure-functions”
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
storage_account_name = azurerm_storage_account.example.name
storage_account_access_key = azurerm_storage_account.example.primary_access_key
}
I have searched high and low and have yet to find any answers in regards to creating a function app successfully in Azure.