Skip to content

Error when deploying a Flex Consumption Function App #26672

Description

@oWretch

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.9.1

AzureRM Provider Version

3.112.0

Affected Resource(s)/Data Source(s)

azurerm_linux_function_app

Terraform Configuration Files

resource "azurerm_linux_function_app" "this" {
  name                = "test-function-app-234asf"
  resource_group_name = azurerm_resource_group.test.name
  location            = azurerm_resource_group.test.location
  service_plan_id     = azurerm_service_plan.test.id

  storage_account_name       = azurerm_storage_account.test.name
  storage_account_access_key = azurerm_storage_account.test.primary_access_key

  site_config {
    application_stack {
      python_version = "3.11"
    }
  }
}

resource "azurerm_service_plan" "test" {
  name                = "test-service-plan"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  sku_name = "FC1"
  os_type  = "Linux"
}

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

resource "azurerm_resource_group" "test" {
  name     = "terraform-test-rg"
  location = "East US"
}

Debug Output/Panic Output

Error: creating Linux App Service (Subscription: "00000000-0000-0000-0000-000000000000"
│ Resource Group Name: "terraform-test-rg"
│ Site Name: "test-function-app-234asf"): performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with response: {"Code":"BadRequest","Message":"Site.FunctionAppConfig is invalid.  The FunctionAppConfig section was not specified in the request, which is required for Flex Consumption sites. To proceed, please add the FunctionAppConfig section in your request.","Target":null,"Details":[{"Message":"Site.FunctionAppConfig is invalid.  The FunctionAppConfig section was not specified in the request, which is required for Flex Consumption sites. To proceed, please add the FunctionAppConfig section in your request."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"51021","MessageTemplate":"{0} is invalid.  {1}","Parameters":["Site.FunctionAppConfig","The FunctionAppConfig section was not specified in the request, which is required for Flex Consumption sites. To proceed, please add the FunctionAppConfig section in your request."],"Code":"BadRequest","Message":"Site.FunctionAppConfig is invalid.  The FunctionAppConfig section was not specified in the request, which is required for Flex Consumption sites. To proceed, please add the FunctionAppConfig section in your request."}}],"Innererror":null}
│ 
│   with azurerm_linux_function_app.this,
│   on azurerm.tf line 1, in resource "azurerm_linux_function_app" "this":
│    1: resource "azurerm_linux_function_app" "this" {

After adding support for the FC1 SKU to the azurerm_service_plan in #26351 as part of #26043 I attempted to also create a flex consumption function app. This failed with the above error.

Resolution of this is dependant upon hashicorp/go-azure-sdk#1017 ,which may be dependant upon an upstream fix - I haven't investigated that far.

I'm mostly raising this issue as a placeholder for a known issue.

As an aside, it seems that Microsoft are making some significant changes to the way the Function App is provisioned - many of the old settings are deprecated and replaced with new settings inside the functionAppConfig structure. Reference: https://learn.microsoft.com/en-us/azure/azure-functions/flex-consumption-plan.

Also, from further testing, the functionAppConfig structure is only supported on the flex consumption function apps.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions