Skip to content

Commit

Permalink
Fix Linux Consumption Function Apps
Browse files Browse the repository at this point in the history
Do not add WEBSITE_CONTENTSHARE and
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING automatically nor ignore it
when comparing resources for Linux Consumption Function Apps. According
to a bug report they should not be there for Linux
Azure/azure-functions-python-worker#598.

Fixes #5209
  • Loading branch information
borancar committed Jun 5, 2020
1 parent 63099c8 commit f9659d6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions azurerm/internal/services/web/resource_arm_function_app.go
Expand Up @@ -664,8 +664,14 @@ func resourceArmFunctionAppRead(d *schema.ResourceData, meta interface{}) error
delete(appSettings, "AzureWebJobsDashboard")
delete(appSettings, "AzureWebJobsStorage")
delete(appSettings, "FUNCTIONS_EXTENSION_VERSION")
delete(appSettings, "WEBSITE_CONTENTSHARE")
delete(appSettings, "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING")

// Let the user have a final say whether he wants to keep these 2 or not on
// Linux consumption plans. They shouldn't be there according to a bug
// report (see // https://github.com/Azure/azure-functions-python-worker/issues/598)
if !strings.EqualFold(d.Get("os_type").(string), "linux") {
delete(appSettings, "WEBSITE_CONTENTSHARE")
delete(appSettings, "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING")
}

if err = d.Set("app_settings", appSettings); err != nil {
return err
Expand Down Expand Up @@ -732,6 +738,7 @@ func getBasicFunctionAppAppSettings(d *schema.ResourceData, appServiceTier, endp
dashboardPropName := "AzureWebJobsDashboard"
storagePropName := "AzureWebJobsStorage"
functionVersionPropName := "FUNCTIONS_EXTENSION_VERSION"

contentSharePropName := "WEBSITE_CONTENTSHARE"
contentFileConnStringPropName := "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"

Expand Down Expand Up @@ -783,8 +790,10 @@ func getBasicFunctionAppAppSettings(d *schema.ResourceData, appServiceTier, endp
{Name: &contentFileConnStringPropName, Value: &storageConnection},
}

// On consumption and premium plans include WEBSITE_CONTENT components
if strings.EqualFold(appServiceTier, "dynamic") || strings.EqualFold(appServiceTier, "elasticpremium") {
// On consumption and premium plans include WEBSITE_CONTENT components, unless it's a Linux consumption plan
// (see https://github.com/Azure/azure-functions-python-worker/issues/598)
if (strings.EqualFold(appServiceTier, "dynamic") || strings.EqualFold(appServiceTier, "elasticpremium")) &&
!strings.EqualFold(d.Get("os_type").(string), "linux") {
return append(basicSettings, consumptionSettings...), nil
}

Expand Down

0 comments on commit f9659d6

Please sign in to comment.